abse/museair-usb

USB-C–powered ESP32-C3 controller board with AP63203 buck conversion, AP2112K 3.3V regulation, I²C SEN62 sensor interface, status LED, buttons, UART/I²C headers, and extensive decoupling.

Version
0.5.7
License
unset
Stars
0

scripts/package-order.py

"""Package only the audited single-board fabrication and SMT order files."""
from pathlib import Path
import datetime,hashlib,json,zipfile
root=Path(__file__).resolve().parent.parent
audit=json.loads((root/'validation/production-audit.json').read_text())
assert audit['status']=='pass' and audit['placed_parts']==29
for rel,digest in audit['sha256'].items():
    assert hashlib.sha256((root/rel).read_bytes()).hexdigest()==digest,rel
files=['order/gerbers.zip','order/bom-jlcpcb.csv','order/cpl-jlcpcb.csv',
       'order/parts-all.csv','order/harness.txt','order/mechanical-assembly.txt',
       'validation/production-audit.json','validation/stock-live.json',
       'validation/tsci-cli-recheck.json','validation/tscircuit-routing-recheck.json',
       'validation/kicad-drc-short-recheck.json','README.txt']
manifest={'project':'MuseAir USB v0.5 — SEN62-SIN-T',
          'created_at_utc':datetime.datetime.now(datetime.timezone.utc).isoformat(),
          'smt_components':29,'jlc_part_numbers':14,
          'sensor_in_smt_assembly':False,
          'order_status':'files prepared; no purchase; stock not reserved',
          'physical_sensor_fit_and_power_tested':False,
          'sha256':{f:hashlib.sha256((root/f).read_bytes()).hexdigest() for f in files}}
(root/'order/ORDER-MANIFEST.json').write_text(json.dumps(manifest,indent=2)+'\n')
out=root.parent/'museair-v05-pcb-only-order.zip'
with zipfile.ZipFile(out,'w',zipfile.ZIP_DEFLATED) as z:
    for f in files+['order/ORDER-MANIFEST.json']:
        z.write(root/f,f)
with zipfile.ZipFile(out) as z:
    assert z.testzip() is None
    for f,digest in manifest['sha256'].items():
        assert hashlib.sha256(z.read(f)).hexdigest()==digest,f
(out.parent/(out.name+'.sha256')).write_text(hashlib.sha256(out.read_bytes()).hexdigest()+'  '+out.name+'\n')
print('Saved matching PCB-only JLC order package')