File tree Expand file tree Collapse file tree 2 files changed +6
-7
lines changed
Expand file tree Collapse file tree 2 files changed +6
-7
lines changed Original file line number Diff line number Diff line change @@ -5,6 +5,7 @@ import argparse
55import hashlib
66import json
77import os .path
8+ import shutil
89import subprocess
910import tempfile
1011import 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 :
Original file line number Diff line number Diff 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
4039def _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 :
You can’t perform that action at this time.
0 commit comments