Skip to content

Commit

Permalink
Fix extracting wheel downloads (#444)
Browse files Browse the repository at this point in the history
  • Loading branch information
karthiknadig authored Aug 27, 2024
1 parent 030769b commit 30560bb
Showing 1 changed file with 3 additions and 7 deletions.
10 changes: 3 additions & 7 deletions noxfile.py
Original file line number Diff line number Diff line change
Expand Up @@ -80,13 +80,9 @@ def download_url(values):
for value in values:
with url_lib.urlopen(value["url"]) as response:
data = response.read()
hash_algorithm, hash_value = [
(key, value) for key, value in value["hash"].items()
][0]
if hashlib.new(hash_algorithm, data).hexdigest() != hash_value:
raise ValueError(
"Failed hash verification for {}.".format(value["url"])
)
name, digest = next(iter(value["hash"].items()))
if hashlib.new(name, data).hexdigest() != digest:
raise ValueError(f"Failed hash verification for {value['url']}.")

print("Download: ", value["url"])
with zipfile.ZipFile(io.BytesIO(data), "r") as wheel:
Expand Down

0 comments on commit 30560bb

Please sign in to comment.