From 8e1c7dccaa3ab6966d2dab95550705e2e7616215 Mon Sep 17 00:00:00 2001 From: Nick Sweeting Date: Wed, 3 Jun 2026 19:45:43 -0700 Subject: [PATCH] fix: wait for released deps before docker build --- .github/workflows/docker.yml | 38 ++++++++++++++++++++++++++++++++++++ 1 file changed, 38 insertions(+) diff --git a/.github/workflows/docker.yml b/.github/workflows/docker.yml index 13378e58..cb88fd63 100644 --- a/.github/workflows/docker.yml +++ b/.github/workflows/docker.yml @@ -45,6 +45,44 @@ jobs: # submodules: true # fetch-depth: 1 + - name: Wait for released ArchiveBox deps on PyPI + run: | + python3 - <<'PY' + import json + import re + import sys + import time + import tomllib + import urllib.request + + watched = {"abxbus", "abxpkg", "abx-plugins", "abx-dl"} + deps = tomllib.loads(open("pyproject.toml", "rb").read().decode())["project"]["dependencies"] + required = {} + for dep in deps: + for name in watched: + match = re.match(rf"{re.escape(name)}\s*(==|>=)\s*([^,;\s]+)", dep) + if match: + required[name] = match.group(2) + + deadline = time.monotonic() + 300 + missing = required.copy() + while missing and time.monotonic() < deadline: + for name, version in list(missing.items()): + with urllib.request.urlopen(f"https://pypi.org/pypi/{name}/json", timeout=20) as resp: + releases = json.load(resp)["releases"] + if version in releases: + print(f"{name} {version} is available on PyPI") + missing.pop(name) + else: + print(f"{name} {version} is not available on PyPI yet") + if missing: + time.sleep(10) + + if missing: + print(f"Missing PyPI releases after wait: {missing}", file=sys.stderr) + sys.exit(1) + PY + - name: Set up Docker Buildx id: buildx uses: docker/setup-buildx-action@v3