"""release.json for the website: the commit published, its source tarball (name, size, SHA-256) and the latest results of every test (summarize.py's tables). python3 release.py [...] """ from __future__ import annotations import hashlib import json import sys from datetime import datetime, timezone from pathlib import Path sys.path.insert(0, str(Path(__file__).resolve().parent)) import summarize # noqa: E402 def main() -> None: commit, tarball, *folders = sys.argv[1:] data = Path(tarball).read_bytes() release = { "commit": commit, "published": datetime.now(timezone.utc).isoformat(timespec="seconds"), "tarball": {"name": Path(tarball).name, "size": len(data), "sha256": hashlib.sha256(data).hexdigest()}, "results": [summarize.summary(Path(f)) for f in folders], } print(json.dumps(release, indent=2, ensure_ascii=False)) if __name__ == "__main__": main()