"""Deterministically embed the standalone phone client in the payload.""" import gzip from pathlib import Path import sys source, output = map(Path, sys.argv[1:]) data = gzip.compress(source.read_bytes(), compresslevel=9, mtime=0) lines = ["/* Generated by tools/embed_client.py. */", "#include ", "const unsigned char c4fPage[] = {"] lines.extend(" " + ",".join(str(n) for n in data[i:i+24]) + "," for i in range(0, len(data), 24)) lines.extend(["};", "const size_t c4fPageSize = sizeof(c4fPage);", ""]) output.parent.mkdir(parents=True, exist_ok=True) output.write_text("\n".join(lines))