Turn audit.py into a run() function and drop audit_run.py, which only existed to import it quietly. Remove unused parameters, keys, helpers and imports from draw.py, manifest.py and stl_build.py, and the source file names in stl_build.FILES that pointed at nothing. Keep the brow strip's taper and knob positions in geom.py only. Correct comments and docstrings that disagreed with the code, and the README's claim about counts. The page changes only in markup: no stray spaces in class attributes, and three CSS declarations that did nothing are gone. Guide HTML, templates and print files are byte-identical apart from that. Credibility pass over a7c04e5..HEAD; the next one can scope from here. Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>
56 lines
2.5 KiB
Python
Executable File
56 lines
2.5 KiB
Python
Executable File
#!/usr/bin/env python3
|
|
# /// script
|
|
# requires-python = ">=3.11"
|
|
# dependencies = ["numpy", "scipy", "shapely", "trimesh", "manifold3d", "mapbox-earcut", "networkx", "rtree", "playwright"]
|
|
# ///
|
|
"""Build the whole Green Man kit and publish it into ../greenman.
|
|
|
|
uv run build.py build everything, then copy the page into ../greenman
|
|
uv run build.py --no-publish build into out/ only
|
|
|
|
Order matters: the print files are checked first because the guides quote the results."""
|
|
import shutil, sys, zipfile
|
|
from pathlib import Path
|
|
from paths import OUT, ASSETS, SITE
|
|
|
|
STAMP = (2026, 1, 1, 0, 0, 0) # fixed date inside the zips, so a zip changes only when its contents do
|
|
|
|
def zip_write(path, entries):
|
|
with zipfile.ZipFile(path, 'w', zipfile.ZIP_DEFLATED) as z:
|
|
for name, src in sorted(entries):
|
|
zi = zipfile.ZipInfo(name, STAMP); zi.compress_type = zipfile.ZIP_DEFLATED; zi.external_attr = 0o644 << 16
|
|
z.writestr(zi, Path(src).read_bytes())
|
|
|
|
def main(publish=True):
|
|
import stl_build
|
|
report = stl_build.build()
|
|
bad = {n: r['verdict'] for n, r in report.items() if r['verdict'].startswith('FAIL')}
|
|
assert not bad, f'print files failed the printability check: {bad}'
|
|
|
|
import audit
|
|
problems = audit.run(verbose=False)
|
|
print(f'audit: {len(problems)} problems')
|
|
assert not problems, f'audit found problems: {problems}'
|
|
import build_templates, build_guides, build_web
|
|
pdfs = [build_templates.build(), build_guides.build('build'), build_guides.build('paint')]
|
|
build_web.build()
|
|
|
|
dl = OUT / 'dl'; shutil.rmtree(dl, ignore_errors=True); dl.mkdir()
|
|
stls = sorted((OUT / 'stl').glob('*.stl'))
|
|
assert {p.name for p in stls} == set(report), 'out/stl holds files the report does not know about'
|
|
for p in pdfs: shutil.copy(p, dl)
|
|
zip_write(dl / 'GreenMan_print_files.zip', [(p.name, p) for p in stls])
|
|
kit = 'GreenMan_mask_kit/'
|
|
zip_write(dl / 'GreenMan_mask_kit.zip', [(kit + Path(p).name, p) for p in pdfs] + [(kit + 'print_files/' + p.name, p) for p in stls] + [(kit + 'README.txt', ASSETS / 'kit_README.txt')])
|
|
|
|
if publish:
|
|
SITE.mkdir(exist_ok=True)
|
|
shutil.copy(OUT / 'index.html', SITE / 'index.html')
|
|
shutil.copy(ASSETS / 'og-image.jpg', SITE / 'og-image.jpg')
|
|
for sub, src in (('img', ASSETS / 'img'), ('dl', dl)):
|
|
shutil.rmtree(SITE / sub, ignore_errors=True); shutil.copytree(src, SITE / sub)
|
|
print(f'published to {SITE}')
|
|
|
|
if __name__ == '__main__':
|
|
main(publish='--no-publish' not in sys.argv)
|