37 lines
1015 B
Python
37 lines
1015 B
Python
#!/usr/bin/env python3
|
|
"""Guard issue #277 parity artifact against non-deterministic regeneration."""
|
|
|
|
from __future__ import annotations
|
|
|
|
import hashlib
|
|
import subprocess
|
|
import sys
|
|
from pathlib import Path
|
|
|
|
REPO_ROOT = Path(__file__).resolve().parents[1]
|
|
ARTIFACT_PATH = REPO_ROOT / "docs" / "ISSUE-277-SHARED-I18N-PARITY-ARTIFACT.md"
|
|
REPORT_SCRIPT = REPO_ROOT / "scripts" / "report_i18n_parity.py"
|
|
|
|
|
|
def sha256(path: Path) -> str:
|
|
return hashlib.sha256(path.read_bytes()).hexdigest()
|
|
|
|
|
|
def main() -> int:
|
|
before = sha256(ARTIFACT_PATH)
|
|
|
|
for run in range(1, 3):
|
|
subprocess.run([sys.executable, str(REPORT_SCRIPT)], cwd=REPO_ROOT, check=True)
|
|
after = sha256(ARTIFACT_PATH)
|
|
if after != before:
|
|
raise SystemExit(
|
|
f"issue #277 parity artifact is not deterministic after run {run}: {before} != {after}"
|
|
)
|
|
|
|
print(f"issue #277 parity artifact deterministic: {before}")
|
|
return 0
|
|
|
|
|
|
if __name__ == "__main__":
|
|
raise SystemExit(main())
|