#!/usr/bin/env python3 """Package only Fuc runtime files; never includes preview data, tests or site settings.""" import hashlib import json from pathlib import Path from zipfile import ZipFile, ZIP_DEFLATED ROOT = Path(__file__).resolve().parents[2] SOURCE = ROOT / 'theme/Fuc' FILES = ['config.json','dashboard.blade.php'] FILES += [str(p.relative_to(SOURCE)) for p in sorted((SOURCE/'assets').glob('*.mjs')) if p.is_file()] FILES += [str(p.relative_to(SOURCE)) for p in sorted((SOURCE/'assets/vendor').rglob('*')) if p.is_file()] FILES += [str(p.relative_to(SOURCE)) for p in sorted((SOURCE/'assets/native').rglob('*')) if p.is_file() and p.name != 'manifest.json'] config = json.loads((SOURCE / 'config.json').read_text()) output = ROOT / 'codex/output/fuc-theme' / f'Fuc-{config["version"]}.zip' output.parent.mkdir(parents=True, exist_ok=True) with ZipFile(output,'w',ZIP_DEFLATED) as bundle: for name in FILES: bundle.write(SOURCE / name, f'Fuc/{name}') print(output) print(f'SHA256 {hashlib.sha256(output.read_bytes()).hexdigest()}')