fix(docker): retry PyPI fetches in realesrgan wheel builder (#6407)

Replace urllib-based PyPI metadata retrieval with curl --retry 8 to
handle transient TLS/SSL EOF errors that abort the Docker image build.
The sdist download also gets retry logic. No functional change to the
patching or wheel-building steps.

Co-authored-by: isharak7m <192635824+isharak7m@users.noreply.github.com>
This commit is contained in:
Isharak
2026-10-31 13:32:28 +00:00
committed by GitHub
co-authored by isharak7m
parent a1a7f8fc9a
commit 239f09cbc4
+32 -10
View File
@@ -31,21 +31,43 @@ for spec in $SPECS; do
name="${spec%%==*}" name="${spec%%==*}"
ver="${spec##*==}" ver="${spec##*==}"
# pip download builds metadata (and trips the same bug), so fetch the raw # pip download builds metadata (and trips the same bug), so fetch the raw
# sdist URL from the PyPI JSON API instead. # sdist URL from the PyPI JSON API instead. Use curl with retries to
url="$(python - "$name" "$ver" <<'PY' # survive transient TLS / network failures that urllib cannot recover from.
import json, sys, urllib.request metadata="${name}-${ver}.json"
name, ver = sys.argv[1], sys.argv[2] curl --fail --silent --show-error --location \
data = json.load(urllib.request.urlopen(f"https://pypi.org/pypi/{name}/{ver}/json")) --retry 8 \
for f in data["urls"]: --retry-delay 3 \
if f["packagetype"] == "sdist": --retry-max-time 120 \
print(f["url"]); break --retry-all-errors \
"https://pypi.org/pypi/${name}/${ver}/json" \
-o "$metadata"
url="$(python - "$metadata" <<'PY'
import json, sys
with open(sys.argv[1], encoding="utf-8") as f:
data = json.load(f)
for item in data["urls"]:
if item["packagetype"] == "sdist":
print(item["url"])
break
else: else:
sys.exit(f"no sdist found for {name}=={ver}") raise SystemExit("no sdist found")
PY PY
)" )"
rm -f "$metadata"
echo ">> fetching ${name} ${ver}: ${url}" echo ">> fetching ${name} ${ver}: ${url}"
curl -fsSL "$url" -o "${name}.tar.gz" curl --fail --silent --show-error --location \
--retry 8 \
--retry-delay 3 \
--retry-max-time 120 \
--retry-all-errors \
"$url" \
-o "${name}.tar.gz"
tar xzf "${name}.tar.gz" tar xzf "${name}.tar.gz"
rm -f "${name}.tar.gz"
done done
echo ">> patching get_version()" echo ">> patching get_version()"