Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

[3.14] gh-134262: Add retries to downloads in PCbuild\get_external.py (GH-134820)#134865

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to ourterms of service andprivacy statement. We’ll occasionally send you account related emails.

Already on GitHub?Sign in to your account

Merged
zware merged 2 commits intopython:3.14frommiss-islington:backport-e9d845b-3.14
May 28, 2025
Merged
Changes fromall commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
23 changes: 21 additions & 2 deletionsPCbuild/get_external.py
View file
Open in desktop
Original file line numberDiff line numberDiff line change
Expand Up@@ -9,17 +9,36 @@
from urllib.request import urlretrieve


def retrieve_with_retries(download_location, output_path, reporthook,
max_retries=7):
"""Download a file with exponential backoff retry and save to disk."""
for attempt in range(max_retries + 1):
try:
resp = urlretrieve(
download_location,
output_path,
reporthook=reporthook,
)
except ConnectionError as ex:
if attempt == max_retries:
msg = f"Download from {download_location} failed."
raise OSError(msg) from ex
time.sleep(2.25**attempt)
else:
return resp


def fetch_zip(commit_hash, zip_dir, *, org='python', binary=False, verbose):
repo = f'cpython-{"bin" if binary else "source"}-deps'
url = f'https://github.com/{org}/{repo}/archive/{commit_hash}.zip'
reporthook = None
if verbose:
reporthook = print
zip_dir.mkdir(parents=True, exist_ok=True)
filename,headers =urlretrieve(
filename,_headers =retrieve_with_retries(
url,
zip_dir / f'{commit_hash}.zip',
reporthook=reporthook,
reporthook
)
return filename

Expand Down
Loading

[8]ページ先頭

©2009-2025 Movatter.jp