Skip to content

Commit 94f1a89

Browse files
Clean up
1 parent 01aed67 commit 94f1a89

File tree

1 file changed

+2
-8
lines changed

1 file changed

+2
-8
lines changed

PCbuild/get_external.py

Lines changed: 2 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -70,16 +70,14 @@ def fetch_zip(commit_hash, zip_dir, *, org='python', binary=False, verbose=False
7070
return filename
7171

7272

73-
def fetch_release_asset(asset_id, output_path, org, verbose=False):
73+
def fetch_release_asset(asset_id, output_path, org):
7474
"""Download a GitHub release asset.
7575
7676
Release assets need the Content-Type header set to
7777
application/octet-stream to download the binary, so we can't use
7878
urlretrieve. Code here is based on urlretrieve.
7979
"""
8080
url = f'https://api.github.com/repos/{org}/cpython-bin-deps/releases/assets/{asset_id}'
81-
if verbose:
82-
print(f'Fetching metadata for asset {asset_id}...')
8381
metadata_resp = get_with_retries(url,
8482
headers={'Accept': 'application/vnd.github+json'})
8583
json_data = json.loads(metadata_resp.read())
@@ -89,8 +87,6 @@ def fetch_release_asset(asset_id, output_path, org, verbose=False):
8987
algorithm, hashsum = hash_info.split(':')
9088
if algorithm != 'sha256':
9189
raise RuntimeError(f'Unknown hash algorithm {algorithm} for asset {asset_id}')
92-
if verbose:
93-
print(f'Downloading asset {asset_id}...')
9490
with contextlib.closing(
9591
get_with_retries(url, headers={'Accept': 'application/octet-stream'})
9692
) as resp:
@@ -101,8 +97,6 @@ def fetch_release_asset(asset_id, output_path, org, verbose=False):
10197
fp.write(block)
10298
if hasher.hexdigest() != hashsum:
10399
raise RuntimeError('Downloaded content hash did not match!')
104-
if verbose:
105-
print(f'Successfully downloaded and verified {output_path}')
106100

107101

108102
def fetch_release(tag, tarball_dir, *, org='python', verbose=False):
@@ -111,7 +105,7 @@ def fetch_release(tag, tarball_dir, *, org='python', verbose=False):
111105
if asset_id is None:
112106
raise ValueError(f'Unknown tag for binary dependencies {tag}')
113107
output_path = tarball_dir / f'{tag}.tar.xz'
114-
fetch_release_asset(asset_id, output_path, org, verbose)
108+
fetch_release_asset(asset_id, output_path, org)
115109
return output_path
116110

117111

0 commit comments

Comments
 (0)