Compare commits

...

1 Commits

Author SHA1 Message Date
Adeeb Shihadeh
f9dd627e57 support pure wheels in shim packages (#75) 2026-04-25 13:35:28 -07:00

View File

@@ -43,9 +43,14 @@ class InstallPrebuilt(build_py):
if plat is None: if plat is None:
raise RuntimeError(f"unsupported platform: {key}") raise RuntimeError(f"unsupported platform: {key}")
whl_name = f"{MODULE}-{VERSION}-py3-none-{plat}.whl" whl_names = [
url = f"{REPO_URL}/releases/download/{TAG}/{whl_name}" f"{MODULE}-{VERSION}-py3-none-{plat}.whl",
f"{MODULE}-{VERSION}-py3-none-any.whl",
]
raw = None
for whl_name in whl_names:
url = f"{REPO_URL}/releases/download/{TAG}/{whl_name}"
print(f"Downloading {url} ...") print(f"Downloading {url} ...")
for attempt in range(3): for attempt in range(3):
try: try:
@@ -53,10 +58,14 @@ class InstallPrebuilt(build_py):
break break
except (URLError, OSError) as e: except (URLError, OSError) as e:
if attempt == 2: if attempt == 2:
if whl_name == whl_names[-1]:
raise raise
break
wait = 2 ** attempt wait = 2 ** attempt
print(f"Download failed ({e}), retrying in {wait}s ...") print(f"Download failed ({e}), retrying in {wait}s ...")
time.sleep(wait) time.sleep(wait)
if raw is not None:
break
print(f"Extracting {DATADIR} ...") print(f"Extracting {DATADIR} ...")
with zipfile.ZipFile(BytesIO(raw)) as zf: with zipfile.ZipFile(BytesIO(raw)) as zf: