"""Build a Windows desktop archive from already compiled, staged resources. This packages an unsigned development build; it does not publish or certify an installer. No model cache, user settings or local index enters the archive. """ import argparse import hashlib import json import os from pathlib import Path import struct import tempfile import zipfile ROOT = Path(__file__).resolve().parents[1] def pe_machine(path): with path.open("rb") as stream: header = stream.read(64) if len(header) != 64 or header[:2] != b"MZ": raise ValueError(f"Not a Windows executable: {path.name}") offset = struct.unpack_from(" path.stat().st_size - 6: raise ValueError(f"Invalid executable header: {path.name}") stream.seek(offset) signature = stream.read(6) if signature[:4] != b"PE\0\0": raise ValueError(f"Invalid PE signature: {path.name}") return struct.unpack_from("