2026-08-11 00:54:05 +08:00
|
|
|
from pathlib import Path
|
|
|
|
|
|
2026-08-26 00:25:46 +08:00
|
|
|
from PyInstaller.utils.hooks import collect_data_files, collect_dynamic_libs, collect_submodules, copy_metadata
|
2026-08-11 00:54:05 +08:00
|
|
|
|
|
|
|
|
|
|
|
|
|
project_root = Path(SPECPATH).parent
|
|
|
|
|
entrypoint = project_root / "server" / "sidecar.py"
|
|
|
|
|
|
|
|
|
|
datas = []
|
|
|
|
|
binaries = []
|
|
|
|
|
hiddenimports = collect_submodules("server")
|
|
|
|
|
hiddenimports += collect_submodules("uvicorn")
|
|
|
|
|
hiddenimports += [
|
|
|
|
|
"ortools.sat.python.cp_model",
|
|
|
|
|
"ortools.sat.python.cp_model_helper",
|
|
|
|
|
"ortools.util.python.sorted_interval_list",
|
|
|
|
|
]
|
|
|
|
|
binaries += collect_dynamic_libs("ortools")
|
2026-08-26 00:25:46 +08:00
|
|
|
datas += collect_data_files("scipy", includes=["stats/_sobol_direction_numbers.npz"])
|
2026-08-11 00:54:05 +08:00
|
|
|
for distribution in ("fastapi", "pydantic", "python-dotenv", "uvicorn"):
|
|
|
|
|
datas += copy_metadata(distribution)
|
|
|
|
|
|
|
|
|
|
a = Analysis(
|
|
|
|
|
[str(entrypoint)],
|
|
|
|
|
pathex=[str(project_root)],
|
|
|
|
|
binaries=binaries,
|
|
|
|
|
datas=datas,
|
|
|
|
|
hiddenimports=hiddenimports,
|
|
|
|
|
hookspath=[],
|
|
|
|
|
hooksconfig={},
|
|
|
|
|
runtime_hooks=[],
|
|
|
|
|
excludes=["IPython", "matplotlib", "notebook", "pytest", "tkinter"],
|
|
|
|
|
noarchive=False,
|
|
|
|
|
optimize=1,
|
|
|
|
|
)
|
|
|
|
|
pyz = PYZ(a.pure)
|
|
|
|
|
|
|
|
|
|
exe = EXE(
|
|
|
|
|
pyz,
|
|
|
|
|
a.scripts,
|
|
|
|
|
[],
|
|
|
|
|
exclude_binaries=True,
|
|
|
|
|
name="aps-sidecar",
|
|
|
|
|
debug=False,
|
|
|
|
|
bootloader_ignore_signals=False,
|
|
|
|
|
strip=False,
|
|
|
|
|
upx=False,
|
|
|
|
|
console=True,
|
|
|
|
|
disable_windowed_traceback=False,
|
|
|
|
|
argv_emulation=False,
|
|
|
|
|
target_arch=None,
|
|
|
|
|
codesign_identity=None,
|
|
|
|
|
entitlements_file=None,
|
|
|
|
|
)
|
|
|
|
|
|
|
|
|
|
coll = COLLECT(
|
|
|
|
|
exe,
|
|
|
|
|
a.binaries,
|
|
|
|
|
a.datas,
|
|
|
|
|
strip=False,
|
|
|
|
|
upx=False,
|
|
|
|
|
upx_exclude=[],
|
|
|
|
|
name="aps-sidecar",
|
|
|
|
|
)
|