IQ.Lvbs: vendor imgui wheels in branch; install from local files
Replaces the upstream GitHub-Releases-fetch shim with a local-wheel shim so the package installs cleanly from a private gitea repo over SSH (no HTTPS download / token plumbing required at install time).
This commit is contained in:
@@ -15,6 +15,6 @@ packages = ["imgui"]
|
||||
imgui = ["*.so", "install/**/*"]
|
||||
|
||||
[tool.shim]
|
||||
repo_url = "https://github.com/commaai/dependencies"
|
||||
tag = "imgui/v1.92.7"
|
||||
# IQ.Lvbs fork: wheels are vendored under wheels/ in this branch; setup.py extracts
|
||||
# the platform-matched wheel locally instead of fetching from a release URL.
|
||||
datadir = "install"
|
||||
|
||||
@@ -1,11 +1,13 @@
|
||||
"""Shim setup.py: downloads pre-built wheels from GitHub Releases at install time."""
|
||||
"""Shim setup.py: extracts pre-built wheels vendored under wheels/ at install time.
|
||||
|
||||
IQ.Lvbs fork of commaai/dependencies. Upstream downloads wheels from GitHub
|
||||
release storage at install time; we vendor the wheel bytes inside the git
|
||||
branch so the install works against a private gitea repo with no extra auth.
|
||||
"""
|
||||
import os
|
||||
import platform
|
||||
import time
|
||||
import zipfile
|
||||
from io import BytesIO
|
||||
from urllib.error import URLError
|
||||
from urllib.request import urlopen
|
||||
|
||||
try:
|
||||
import tomllib
|
||||
@@ -19,13 +21,11 @@ _HERE = os.path.dirname(os.path.abspath(__file__))
|
||||
with open(os.path.join(_HERE, "pyproject.toml"), "rb") as _f:
|
||||
_cfg = tomllib.load(_f)
|
||||
|
||||
REPO_URL = _cfg["tool"]["shim"]["repo_url"]
|
||||
TAG = _cfg["tool"]["shim"]["tag"]
|
||||
DATADIR = _cfg["tool"]["shim"]["datadir"]
|
||||
VERSION = _cfg["project"]["version"]
|
||||
MODULE = _cfg["project"]["name"].replace("-", "_")
|
||||
|
||||
# all top-level packages bundled in this wheel (e.g. acados + casadi).
|
||||
# all top-level packages bundled in this wheel.
|
||||
# `packages` may be a flat list or a dict with find.include patterns.
|
||||
_pkgs = _cfg.get("tool", {}).get("setuptools", {}).get("packages", [f"{MODULE}*"])
|
||||
if isinstance(_pkgs, list):
|
||||
@@ -48,37 +48,32 @@ class InstallPrebuilt(build_py):
|
||||
module_dir = os.path.join(_HERE, MODULE)
|
||||
data_dir = os.path.join(module_dir, DATADIR)
|
||||
|
||||
if not os.path.exists(os.path.join(data_dir, "bin")):
|
||||
if not os.path.exists(os.path.join(data_dir, "lib")) and not os.path.exists(os.path.join(data_dir, "bin")):
|
||||
key = (platform.system(), platform.machine())
|
||||
plat = PLATFORM_MAP.get(key)
|
||||
if plat is None:
|
||||
raise RuntimeError(f"unsupported platform: {key}")
|
||||
|
||||
whl_names = [
|
||||
candidates = [
|
||||
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} ...")
|
||||
for attempt in range(3):
|
||||
try:
|
||||
raw = urlopen(url, timeout=60).read()
|
||||
break
|
||||
except (URLError, OSError) as e:
|
||||
if attempt == 2:
|
||||
if whl_name == whl_names[-1]:
|
||||
raise
|
||||
break
|
||||
wait = 2 ** attempt
|
||||
print(f"Download failed ({e}), retrying in {wait}s ...")
|
||||
time.sleep(wait)
|
||||
if raw is not None:
|
||||
whl_path = None
|
||||
wheels_dir = os.path.join(_HERE, "wheels")
|
||||
for name in candidates:
|
||||
candidate = os.path.join(wheels_dir, name)
|
||||
if os.path.exists(candidate):
|
||||
whl_path = candidate
|
||||
break
|
||||
if whl_path is None:
|
||||
raise RuntimeError(
|
||||
f"vendored wheel not found for platform {key} under {wheels_dir} "
|
||||
f"(looked for: {', '.join(candidates)})"
|
||||
)
|
||||
|
||||
print("Extracting wheel ...")
|
||||
print(f"Extracting vendored wheel {whl_path} ...")
|
||||
with open(whl_path, "rb") as f:
|
||||
raw = f.read()
|
||||
with zipfile.ZipFile(BytesIO(raw)) as zf:
|
||||
purelib_data = f"{MODULE}-{VERSION}.data/purelib/"
|
||||
for info in zf.infolist():
|
||||
|
||||
BIN
imgui/wheels/imgui-1.92.7-py3-none-linux_aarch64.whl
Normal file
BIN
imgui/wheels/imgui-1.92.7-py3-none-linux_aarch64.whl
Normal file
Binary file not shown.
BIN
imgui/wheels/imgui-1.92.7-py3-none-linux_x86_64.whl
Normal file
BIN
imgui/wheels/imgui-1.92.7-py3-none-linux_x86_64.whl
Normal file
Binary file not shown.
BIN
imgui/wheels/imgui-1.92.7-py3-none-macosx_11_0_arm64.whl
Normal file
BIN
imgui/wheels/imgui-1.92.7-py3-none-macosx_11_0_arm64.whl
Normal file
Binary file not shown.
Reference in New Issue
Block a user