mirror of
https://github.com/GAM-team/GAM.git
synced 2026-06-03 22:01:39 +00:00
Some checks failed
Build and test GAM / build (false, build, 1, Build Intel Ubuntu Jammy, ubuntu-22.04) (push) Has been cancelled
Build and test GAM / build (false, build, 10, Build x86_64 macOS 15, macos-15-intel) (push) Has been cancelled
Build and test GAM / build (false, build, 11, Build x86_64 macOS 26, macos-26-intel) (push) Has been cancelled
Build and test GAM / build (false, build, 12, Build Arm MacOS 26, macos-26) (push) Has been cancelled
Build and test GAM / build (false, build, 13, Build Intel Windows, windows-2025-vs2026) (push) Has been cancelled
Build and test GAM / build (false, build, 14, Build Arm Windows, windows-11-arm) (push) Has been cancelled
Build and test GAM / build (false, build, 2, Build Intel Ubuntu Noble, ubuntu-24.04) (push) Has been cancelled
Build and test GAM / build (false, build, 3, Build Arm Ubuntu Noble, ubuntu-24.04-arm) (push) Has been cancelled
Build and test GAM / build (false, build, 4, Build Arm Ubuntu Jammy, ubuntu-22.04-arm) (push) Has been cancelled
Build and test GAM / build (false, build, 5, Build Intel StaticX Legacy, ubuntu-22.04, yes) (push) Has been cancelled
Build and test GAM / build (false, build, 6, Build Arm StaticX Legacy, ubuntu-22.04-arm, yes) (push) Has been cancelled
Build and test GAM / build (false, build, 8, Build Arm MacOS 14, macos-14) (push) Has been cancelled
Build and test GAM / build (false, build, 9, Build Arm MacOS 15, macos-15) (push) Has been cancelled
Build and test GAM / build (false, test, 15, Test Python 3.10, ubuntu-24.04, 3.10) (push) Has been cancelled
Build and test GAM / build (false, test, 16, Test Python 3.11, ubuntu-24.04, 3.11) (push) Has been cancelled
Build and test GAM / build (false, test, 17, Test Python 3.12, ubuntu-24.04, 3.12) (push) Has been cancelled
Build and test GAM / build (false, test, 18, Test Python 3.13, ubuntu-24.04, 3.13) (push) Has been cancelled
Build and test GAM / build (false, test, 19, Test Python 3.15-dev, ubuntu-24.04, 3.15-dev) (push) Has been cancelled
Build and test GAM / build (true, test, 20, Test Python 3.14 freethread, ubuntu-24.04, 3.14) (push) Has been cancelled
Build and test GAM / publish (push) Has been cancelled
CodeQL / Analyze (python) (push) Has been cancelled
Check for Google Root CA Updates / check-certs (push) Has been cancelled
Quarantined Dependency Upgrade / upgrade-dependencies (push) Has been cancelled
The `apply_overrides.py` script and the resulting `[tool.uv]` block in `pyproject.toml` used the key name `overrides`, but uv expects `override-dependencies`. With the wrong key, uv prints a warning and silently ignores the entire `[tool.uv]` block, so dependency overrides specified in `dep-overrides.txt` have no effect on resolution. Rename `overrides` -> `override-dependencies` in both the script and the current pyproject.toml entry so future override entries written by the upgrade-deps workflow take effect. Reference: https://docs.astral.sh/uv/reference/settings/#override-dependencies
95 lines
2.9 KiB
Python
95 lines
2.9 KiB
Python
#!/usr/bin/env python3
|
|
import datetime
|
|
import sys
|
|
from pathlib import Path
|
|
|
|
try:
|
|
import tomllib
|
|
except ImportError:
|
|
import tomli as tomllib
|
|
|
|
try:
|
|
import tomli_w
|
|
except ImportError:
|
|
print("Error: tomli_w is required. Install it via 'pip install tomli-w' or 'uv'")
|
|
sys.exit(1)
|
|
|
|
|
|
def parse_overrides(file_path: Path) -> list[str]:
|
|
"""Reads dep-overrides.txt and returns list of unexpired override requirements."""
|
|
active_overrides = []
|
|
today = datetime.date.today()
|
|
|
|
if not file_path.exists():
|
|
print(f"No overrides file found at {file_path}. Skipping.")
|
|
return active_overrides
|
|
|
|
with open(file_path, "r", encoding="utf-8") as f:
|
|
for line in f:
|
|
line = line.strip()
|
|
if not line or line.startswith("#"):
|
|
continue
|
|
|
|
try:
|
|
# Split on the pipe delimiter: "urllib3>=2.7.0 | 05/22/2026"
|
|
requirement, date_str = [part.strip() for part in line.split("|", 1)]
|
|
|
|
# Parse expiration date
|
|
month, day, year = map(int, date_str.split("/"))
|
|
expiration_date = datetime.date(year, month, day)
|
|
|
|
if expiration_date >= today:
|
|
# Directly append the exact requirement defined in the file
|
|
active_overrides.append(requirement)
|
|
print(f"Active override: {requirement} (expires {date_str})")
|
|
else:
|
|
print(f"Expired override: {requirement} (expired on {date_str})")
|
|
except Exception as e:
|
|
print(f"Skipping malformed line '{line}': {e}", file=sys.stderr)
|
|
|
|
return active_overrides
|
|
|
|
|
|
def main():
|
|
project_root = Path.cwd()
|
|
overrides_file = project_root / "dep-overrides.txt"
|
|
toml_file = project_root / "pyproject.toml"
|
|
|
|
if not toml_file.exists():
|
|
print("Error: pyproject.toml not found.", file=sys.stderr)
|
|
sys.exit(1)
|
|
|
|
# 1. Parse active overrides
|
|
overrides = parse_overrides(overrides_file)
|
|
|
|
# 2. Read pyproject.toml
|
|
with open(toml_file, "rb") as f:
|
|
pyproject = tomllib.load(f)
|
|
|
|
# Ensure [tool.uv] section exists
|
|
if "tool" not in pyproject:
|
|
pyproject["tool"] = {}
|
|
if "uv" not in pyproject["tool"]:
|
|
pyproject["tool"]["uv"] = {}
|
|
|
|
# 3. Update overrides list
|
|
original_overrides = pyproject["tool"]["uv"].get("override-dependencies", [])
|
|
|
|
if overrides:
|
|
pyproject["tool"]["uv"]["override-dependencies"] = overrides
|
|
else:
|
|
# If all overrides are expired, drop the key entirely
|
|
pyproject["tool"]["uv"].pop("override-dependencies", None)
|
|
|
|
# 4. Save changes only if they differ
|
|
if original_overrides != overrides:
|
|
with open(toml_file, "wb") as f:
|
|
tomli_w.dump(pyproject, f)
|
|
print("Updated pyproject.toml with current overrides.")
|
|
else:
|
|
print("No changes needed for pyproject.toml overrides.")
|
|
|
|
|
|
if __name__ == "__main__":
|
|
main()
|