Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 9 additions & 3 deletions scripts/ci/release_plan.py
Original file line number Diff line number Diff line change
Expand Up @@ -39,8 +39,6 @@
import urllib.request
from pathlib import Path

import tomllib

ROOT = Path(__file__).resolve().parents[2]
PACKAGES = {
"types": "openadapt-types",
Expand All @@ -63,6 +61,14 @@ def _newest_green():
return module


def _toml(text: str) -> dict:
# Imported here: the release workflow runs Python 3.12, but the launcher's
# tests import this module on 3.10 too, which has no tomllib.
import tomllib

return tomllib.loads(text)


def version_key(version: str) -> tuple:
"""Order release versions (X.Y.Z with an optional pre-release suffix)."""
match = re.fullmatch(r"(\d+(?:\.\d+)*)(.*)", version)
Expand Down Expand Up @@ -201,7 +207,7 @@ def main(argv: list[str] | None = None) -> int:
for package in PACKAGES if args.package == "all" else [args.package]:
project = PACKAGES[package]
directory = ROOT / "packages" / package
meta = tomllib.loads((directory / "pyproject.toml").read_text(encoding="utf-8"))
meta = _toml((directory / "pyproject.toml").read_text(encoding="utf-8"))
if meta["project"]["name"] != project:
raise SystemExit(
f"packages/{package} is {meta['project']['name']}, not {project}"
Expand Down
Loading