Files
ingglish-hyperdope-gematria/packaging/bundle/scripts/pdf_create.py
T

31 lines
1.0 KiB
Python
Executable File

#!/usr/bin/env python3
"""Thin delegator to canonical ingglish-aq-archive/scripts/pdf_create.py."""
from __future__ import annotations
import os
import runpy
from pathlib import Path
_SCRIPT_NAME = "pdf_create.py"
def _resolve_canonical() -> Path:
here = Path(__file__).resolve()
for anc in here.parents:
cand = anc / "ingglish-aq-archive" / "scripts" / _SCRIPT_NAME
if cand.is_file() and cand.resolve() != here:
return cand
ws = Path(os.environ.get("WORKSPACE_DIR", "/workspace"))
for cand in (
ws / "ingglish-hyperdope-gematria" / "ingglish-aq-archive" / "scripts" / _SCRIPT_NAME,
ws / "ingglish-aq-archive" / "scripts" / _SCRIPT_NAME,
Path("/usr/libexec/ingglish-exegesis/scripts") / _SCRIPT_NAME,
):
if cand.is_file() and cand.resolve() != here:
return cand
raise FileNotFoundError(f"Canonical script not found: {_SCRIPT_NAME}")
if __name__ == "__main__":
runpy.run_path(str(_resolve_canonical()), run_name="__main__")