feat: add PyInstaller spec + Windows build script (console=True)
This commit is contained in:
@@ -0,0 +1,63 @@
|
||||
# -*- mode: python ; coding: utf-8 -*-
|
||||
"""PyInstaller spec for Zynq Flasher — Windows x64 single-exe build.
|
||||
|
||||
Usage:
|
||||
pyinstaller --clean --noconfirm ZynqFlaster.spec
|
||||
→ output: dist/ZynqFlaster.exe
|
||||
"""
|
||||
|
||||
from PyInstaller.utils.hooks import collect_data_files, collect_submodules
|
||||
|
||||
block_cipher = None
|
||||
|
||||
a = Analysis(
|
||||
['app.py'],
|
||||
pathex=['src'],
|
||||
binaries=[],
|
||||
datas=[
|
||||
# CustomTkinter themes, fonts, icons — auto-collected
|
||||
*collect_data_files('customtkinter'),
|
||||
# Default config shipped as template
|
||||
('config/default_config.yaml', 'config'),
|
||||
],
|
||||
hiddenimports=[
|
||||
*collect_submodules('customtkinter'),
|
||||
'darkdetect',
|
||||
'yaml',
|
||||
'serial',
|
||||
'serial.tools',
|
||||
'serial.tools.list_ports',
|
||||
],
|
||||
hookspath=[],
|
||||
hooksconfig={},
|
||||
runtime_hooks=[],
|
||||
excludes=[],
|
||||
win_no_prefer_redirects=False,
|
||||
win_private_assemblies=False,
|
||||
cipher=block_cipher,
|
||||
noarchive=False,
|
||||
)
|
||||
|
||||
pyz = PYZ(a.pure)
|
||||
|
||||
exe = EXE(
|
||||
pyz,
|
||||
a.scripts,
|
||||
a.binaries,
|
||||
a.zipfiles,
|
||||
a.datas,
|
||||
[],
|
||||
name='ZynqFlaster',
|
||||
debug=False,
|
||||
bootloader_ignore_signals=False,
|
||||
strip=False,
|
||||
upx=True,
|
||||
upx_exclude=[],
|
||||
runtime_tmpdir=None,
|
||||
console=True, # show console for terminal log output
|
||||
disable_windowed_traceback=False,
|
||||
argv_emulation=False,
|
||||
target_arch=None,
|
||||
codesign_identity=None,
|
||||
entitlements_file=None,
|
||||
)
|
||||
@@ -0,0 +1,47 @@
|
||||
@echo off
|
||||
setlocal
|
||||
|
||||
echo ============================================================
|
||||
echo Zynq Flasher — Windows x64 Build Script
|
||||
echo ============================================================
|
||||
echo.
|
||||
|
||||
REM ── 1. Check Python ─────────────────────────────────────────
|
||||
python --version >nul 2>&1
|
||||
if %errorlevel% neq 0 (
|
||||
echo [ERROR] Python not found. Install Python 3.9+ first.
|
||||
pause
|
||||
exit /b 1
|
||||
)
|
||||
echo [1/4] Python: OK
|
||||
|
||||
REM ── 2. Install dependencies ─────────────────────────────────
|
||||
echo [2/4] Installing Python packages...
|
||||
pip install -r requirements.txt --quiet
|
||||
pip install pyinstaller --quiet
|
||||
echo Done.
|
||||
|
||||
REM ── 3. Clean previous builds ────────────────────────────────
|
||||
echo [3/4] Cleaning previous builds...
|
||||
if exist build rmdir /s /q build
|
||||
if exist dist\ZynqFlaster.exe del /q dist\ZynqFlaster.exe
|
||||
if not exist dist mkdir dist
|
||||
|
||||
REM ── 4. Build ────────────────────────────────────────────────
|
||||
echo [4/4] Building ZynqFlaster.exe...
|
||||
pyinstaller --clean --noconfirm ZynqFlaster.spec
|
||||
|
||||
echo.
|
||||
if exist dist\ZynqFlaster.exe (
|
||||
echo ============================================================
|
||||
echo Build successful!
|
||||
echo Output: dist\ZynqFlaster.exe
|
||||
echo ============================================================
|
||||
) else (
|
||||
echo [ERROR] Build failed — dist\ZynqFlaster.exe not found.
|
||||
pause
|
||||
exit /b 1
|
||||
)
|
||||
|
||||
endlocal
|
||||
pause
|
||||
Reference in New Issue
Block a user