Skip to content

Commit 4126106

Browse files
committed
feedback
1 parent b7e425b commit 4126106

File tree

2 files changed

+6
-7
lines changed

2 files changed

+6
-7
lines changed

bin/backfill-core-metadata

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@ import argparse
55
import hashlib
66
import json
77
import os.path
8+
import shutil
89
import subprocess
910
import tempfile
1011
import urllib.parse
@@ -42,12 +43,12 @@ def main(argv: Sequence[str] | None = None) -> int:
4243
continue
4344

4445
url = f"{args.pypi_url}/wheels/{basename}"
45-
fp = f"{tmpdir}/{basename}"
46+
fn = f"{tmpdir}/{basename}"
4647

47-
with urllib.request.urlopen(url) as resp, open(fp, "wb") as f:
48-
f.write(resp.read())
48+
with urllib.request.urlopen(url) as resp, open(fn, "wb") as f:
49+
shutil.copyfileobj(resp, f)
4950

50-
metadata_bytes = _get_metadata_bytes(fp)
51+
metadata_bytes = _get_metadata_bytes(fn)
5152
metadata_sha256 = hashlib.sha256(metadata_bytes).hexdigest()
5253

5354
with open(f"{tmpdir}/metadata/{basename}.metadata", "wb") as f:

make_index.py

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -33,8 +33,7 @@ def _get_metadata_bytes(filename: str) -> bytes:
3333
if name.endswith(".dist-info/METADATA") and name.count("/") == 1
3434
)
3535
with zipf.open(metadata) as f:
36-
metadata_bytes = f.read()
37-
return metadata_bytes
36+
return f.read()
3837

3938

4039
def _make_info(filename: str) -> dict[str, Any]:
@@ -92,7 +91,6 @@ def main(argv: Sequence[str] | None = None) -> int:
9291
for filename in filenames
9392
):
9493
basename = os.path.basename(filename)
95-
9694
if basename in on_pypi:
9795
raise AssertionError(f"{basename}: already on pypi?")
9896
elif basename in seen:

0 commit comments

Comments
 (0)