File size: 1,660 Bytes
1c951bb
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
#!/usr/bin/env python3
"""
Release builder and verification runner for UnsolvedEarth v1.0.0.
Runs validate.py, check_identifiers.py, and check_links.py, and prints the release summary.
"""

import json
import subprocess
import sys
from pathlib import Path

ROOT = Path(__file__).resolve().parent.parent


def run_step(script_name):
    print(f"\n>>> Running {script_name} ...")
    res = subprocess.run([sys.executable, str(ROOT / "scripts" / script_name)], cwd=str(ROOT))
    if res.returncode != 0:
        print(f"ERROR: {script_name} failed with exit code {res.returncode}")
        sys.exit(res.returncode)


def main():
    run_step("validate.py")
    run_step("check_identifiers.py")
    run_step("check_links.py")

    stats = json.loads((ROOT / "statistics.json").read_text(encoding="utf-8"))
    print("\n" + "=" * 72)
    print(f"UnsolvedEarth v{stats['version']} Release Summary ({stats['release_date']})")
    print("=" * 72)
    print(f"  Total Records in problems.json : {stats['total_records']:,}")
    print(f"  Published Open/Partial Problems: {stats['published_problems']:,}")
    print(f"  Archived Audit Style Pack      : {stats['archived_audit_records']:,}")
    print(f"  Unique Registered Sources      : {stats['unique_sources']:,}")
    print(f"  Max Problems per Single Source : {stats['max_problems_per_source']}")
    print(f"  International Source Share     : {stats['international_source_share'] * 100:.1f}%")
    print("  Published Status Breakdown     :", stats["by_status_published"])
    print("  Published Difficulty Breakdown :", stats["by_difficulty_published"])
    print("=" * 72)


if __name__ == "__main__":
    main()