AnasSarkiz/magnetic-shutter-remote-r8

A USB‑C rechargeable battery-powered ESP32‑C3 wireless controller with Li‑ion charging, protected 3.3‑V buck‑boost regulation, thermal/safety monitoring, status LEDs, buttons, programming UART, crystal clock, and 2.4‑GHz antenna matching network.

Version
0.4.0-prototype
License
unset
Stars
0

scripts/export-r8-gerber-zip.py

"""Package already-generated native Gerber/Excellon files without modifying them."""
import argparse
from zipfile import ZipFile, ZIP_DEFLATED
from pathlib import Path


def export_zip(gerber_directory, output):
    sources = sorted(gerber_directory.iterdir())
    if len(sources) != 12 or any(not source.is_file() for source in sources):
        raise ValueError('Expected exactly 12 reviewed native fabrication files')
    if output.resolve().parent == gerber_directory.resolve():
        raise ValueError('Archive must be outside the native fabrication directory')
    with ZipFile(output, 'w', ZIP_DEFLATED) as archive:
        for source in sources:
            archive.write(source, source.name)
    print(f'{len(sources)} original native files packaged in {output}')


if __name__ == '__main__':
    parser = argparse.ArgumentParser()
    parser.add_argument('gerber_directory', type=Path)
    parser.add_argument('output', type=Path)
    args = parser.parse_args()
    export_zip(args.gerber_directory, args.output)