|
| 1 | +#!/usr/bin/env python3 |
| 2 | +"""Keep the maintained EN/ZH/DE README release/runtime contracts aligned.""" |
| 3 | + |
| 4 | +from __future__ import annotations |
| 5 | + |
| 6 | +import sys |
| 7 | +from pathlib import Path |
| 8 | + |
| 9 | +ROOT = Path(__file__).resolve().parents[1] |
| 10 | +READMES = ( |
| 11 | + ROOT / "README.md", |
| 12 | + ROOT / "docs/readme/README_zh-CN.md", |
| 13 | + ROOT / "docs/readme/README_de.md", |
| 14 | +) |
| 15 | + |
| 16 | +REQUIRED = ( |
| 17 | + "v6.6.8", |
| 18 | + "v6.68-x86-setup.exe", |
| 19 | + "iphotron_6.6.8_amd64.deb", |
| 20 | + "iPhotron-6.6.8-x86_64.AppImage", |
| 21 | + "com.github.OliverZhaohaibin.iPhotron-6.6.8-x86_64.flatpak", |
| 22 | + "iPhoto.entrypoint:main", |
| 23 | + "DesktopCoordinatorRuntime", |
| 24 | + "species-bounded-single-link-v3", |
| 25 | + "torchscript_url", |
| 26 | + "BUILD_FLATPAK.md", |
| 27 | +) |
| 28 | + |
| 29 | + |
| 30 | +def main() -> int: |
| 31 | + failures: list[str] = [] |
| 32 | + for path in READMES: |
| 33 | + if not path.is_file(): |
| 34 | + failures.append(f"missing maintained README: {path.relative_to(ROOT)}") |
| 35 | + continue |
| 36 | + text = path.read_text(encoding="utf-8") |
| 37 | + for token in REQUIRED: |
| 38 | + if token not in text: |
| 39 | + failures.append(f"{path.relative_to(ROOT)}: missing parity token {token!r}") |
| 40 | + |
| 41 | + if failures: |
| 42 | + print("README parity check failed:", file=sys.stderr) |
| 43 | + for failure in failures: |
| 44 | + print(f"- {failure}", file=sys.stderr) |
| 45 | + return 1 |
| 46 | + |
| 47 | + print("README parity OK: EN/ZH/DE release and runtime contracts are aligned.") |
| 48 | + return 0 |
| 49 | + |
| 50 | + |
| 51 | +if __name__ == "__main__": |
| 52 | + raise SystemExit(main()) |
0 commit comments