Fix PyInstaller spec: bundle modules as Python code not raw data
All checks were successful
Build Windows EXE / build (push) Successful in 50s

Using datas to include modules/ caused stdlib imports (json etc.) to fail
at runtime. Adding modules/ to pathex lets PyInstaller properly analyse
and compile them into the bundle alongside the rest of the stdlib.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
2026-04-16 18:33:59 -04:00
parent 2505083fd7
commit 3ba52b2c62

View File

@@ -1,15 +1,16 @@
# PyInstaller spec for es24n_conf Windows .exe # PyInstaller spec for es24n_conf Windows .exe
# Build with: pyinstaller es24n_conf.spec # Build with: pyinstaller es24n_conf.spec
import os
from PyInstaller.building.build_main import Analysis, PYZ, EXE from PyInstaller.building.build_main import Analysis, PYZ, EXE
modules_dir = os.path.join(os.path.dirname(os.path.abspath(SPEC)), "modules")
a = Analysis( a = Analysis(
["es24n_conf.py"], ["es24n_conf.py"],
pathex=[], pathex=[modules_dir],
binaries=[], binaries=[],
datas=[ datas=[],
("modules", "modules"),
],
hiddenimports=[ hiddenimports=[
"serial", "serial",
"serial.tools", "serial.tools",
@@ -35,7 +36,7 @@ exe = EXE(
bootloader_ignore_signals=False, bootloader_ignore_signals=False,
strip=False, strip=False,
upx=True, upx=True,
console=True, # console app — must stay True for terminal UI console=True,
disable_windowed_traceback=False, disable_windowed_traceback=False,
target_arch=None, target_arch=None,
codesign_identity=None, codesign_identity=None,