Script: build.py
Collatz and Riemann: source and evidence
build.py
This is the original source text. Reading it does not run or verify the program.
1 """Build the expanded conjecture monographs and their separate visual guides."""
2 from pathlib import Path
3 import argparse
4 import shutil
5 import subprocess
6 import sys
7
8 ROOT = Path(__file__).resolve().parent
9 parser = argparse.ArgumentParser()
10 parser.add_argument("--figures", action="store_true")
11 parser.add_argument("--only", choices=["collatz", "riemann", "collatz_visual", "riemann_visual"])
12 args = parser.parse_args()
13 if args.figures:
14 subprocess.run([sys.executable, str(ROOT / "shared" / "figures.py")], check=True)
15 for guide in ["collatz_visual", "riemann_visual"]:
16 subprocess.run([sys.executable, str(ROOT / guide / "figures.py")], check=True)
17 outdir = ROOT / "pdf"
18 outdir.mkdir(exist_ok=True)
19 names = {
20 "collatz": "Komorebi_Collatz_Conjecture_Piece_v1.1.pdf",
21 "riemann": "Komorebi_Riemann_Conjecture_Piece_v1.1.pdf",
22 "collatz_visual": "Komorebi_Collatz_Visual_Guide_v1.1.pdf",
23 "riemann_visual": "Komorebi_Riemann_Visual_Guide_v1.1.pdf",
24 }
25 for name in ([args.only] if args.only else names):
26 folder = ROOT / name
27 for _ in range(2):
28 proc = subprocess.run(
29 ["pdflatex", "-interaction=nonstopmode", "-halt-on-error", "main.tex"],
30 cwd=folder, text=True, capture_output=True,
31 )
32 (folder / "build_stdout.log").write_text(proc.stdout + proc.stderr)
33 if proc.returncode:
34 print(proc.stdout[-7000:], file=sys.stderr)
35 raise SystemExit(proc.returncode)
36 dest = outdir / names[name]
37 shutil.copyfile(folder / "main.pdf", dest)
38 print(dest)
Other PDFs for this work
Original file and source record
This copy matches the recorded source file. Its publication here does not change the work’s review status.
SHA-256: 04853111ec0c531a860f71664548bceca6bf497a95f84d764b21164b8fa6c655