2021-02-04 19:22:36 +00:00
|
|
|
#!/usr/bin/env python3
|
|
|
|
import shutil
|
|
|
|
import subprocess
|
|
|
|
from pathlib import Path
|
|
|
|
|
|
|
|
|
|
|
|
here = Path(__file__).parent
|
|
|
|
|
2021-02-13 11:29:52 +00:00
|
|
|
for script in sorted((here / "scripts").glob("*.py")):
|
2021-02-04 19:22:36 +00:00
|
|
|
print(f"Generating output for {script.name}...")
|
2021-05-11 09:17:09 +00:00
|
|
|
out = subprocess.check_output(["python3", script.absolute()], cwd=here, text=True)
|
2021-02-04 19:22:36 +00:00
|
|
|
if out:
|
2021-02-04 21:52:28 +00:00
|
|
|
(here / "src" / "generated" / f"{script.stem}.html").write_text(out, encoding="utf8")
|
2021-02-04 19:22:36 +00:00
|
|
|
|
|
|
|
if (here / "public").exists():
|
|
|
|
shutil.rmtree(here / "public")
|
2021-02-13 11:26:44 +00:00
|
|
|
subprocess.run(["hugo"], cwd=here / "src", check=True)
|