updated
This commit is contained in:
@@ -38,7 +38,7 @@ if errorlevel 1 (
|
||||
echo.
|
||||
|
||||
REM Install dependencies
|
||||
echo [3/5] Installing dependencies...
|
||||
echo [3/6] Installing dependencies...
|
||||
echo Installing: python-barcode, pillow, reportlab, kivy, pyinstaller, pywin32, wmi, watchdog, svglib, cairosvg, pystray...
|
||||
pip install python-barcode pillow reportlab kivy pyinstaller pywin32 wmi watchdog svglib cairosvg pystray
|
||||
if errorlevel 1 (
|
||||
@@ -48,6 +48,11 @@ if errorlevel 1 (
|
||||
)
|
||||
echo.
|
||||
|
||||
REM Copy GhostScript binaries for bundling (optional but strongly recommended)
|
||||
echo [4/6] Preparing GhostScript for bundling...
|
||||
call prepare_ghostscript.bat
|
||||
echo.
|
||||
|
||||
REM Check that SumatraPDF.exe exists before building
|
||||
if not exist "conf\SumatraPDF.exe" (
|
||||
echo ERROR: conf\SumatraPDF.exe not found!
|
||||
@@ -59,43 +64,20 @@ if not exist "conf\SumatraPDF.exe" (
|
||||
echo conf\SumatraPDF.exe found - will be bundled into executable.
|
||||
echo.
|
||||
|
||||
REM Clean old build
|
||||
echo [4/5] Cleaning old build artifacts...
|
||||
REM Clean old build (keep the spec file - it's handcrafted)
|
||||
echo [5/6] Cleaning old build artifacts...
|
||||
if exist "dist" rmdir /s /q dist
|
||||
if exist "build" rmdir /s /q build
|
||||
if exist "*.spec" del *.spec
|
||||
echo.
|
||||
|
||||
REM Build with PyInstaller
|
||||
echo [5/5] Building executable with PyInstaller...
|
||||
REM Build with PyInstaller using the spec file.
|
||||
REM The spec (LabelPrinter.spec) contains Python code that detects whether
|
||||
REM conf\ghostscript\ was prepared and includes those files automatically.
|
||||
echo [6/6] Building executable with PyInstaller...
|
||||
echo This may take 5-15 minutes, please wait...
|
||||
echo.
|
||||
|
||||
pyinstaller label_printer_gui.py ^
|
||||
--onefile ^
|
||||
--windowed ^
|
||||
--name=LabelPrinter ^
|
||||
--distpath=./dist ^
|
||||
--workpath=./build ^
|
||||
--hidden-import=kivy ^
|
||||
--hidden-import=PIL ^
|
||||
--hidden-import=barcode ^
|
||||
--hidden-import=reportlab ^
|
||||
--hidden-import=print_label ^
|
||||
--hidden-import=print_label_pdf ^
|
||||
--hidden-import=svglib ^
|
||||
--hidden-import=cairosvg ^
|
||||
--hidden-import=watchdog ^
|
||||
--hidden-import=watchdog.observers ^
|
||||
--hidden-import=watchdog.events ^
|
||||
--hidden-import=pystray ^
|
||||
--hidden-import=win32timezone ^
|
||||
--add-data "conf\SumatraPDF.exe;." ^
|
||||
--add-data "conf\SumatraPDF-settings.txt;conf" ^
|
||||
--add-data "conf\label_template_ok.svg;conf" ^
|
||||
--add-data "conf\label_template_nok.svg;conf" ^
|
||||
--add-data "conf\label_template.svg;conf" ^
|
||||
-y
|
||||
pyinstaller LabelPrinter.spec --distpath=./dist --workpath=./build -y
|
||||
|
||||
if errorlevel 1 (
|
||||
echo.
|
||||
@@ -129,7 +111,8 @@ echo Next steps:
|
||||
echo 1. Copy the entire dist\ folder to the target machine
|
||||
echo (it contains LabelPrinter.exe AND the conf\ folder)
|
||||
echo 2. Run LabelPrinter.exe from the dist folder
|
||||
echo 3. Ensure conf\SumatraPDF.exe is present for printing to work
|
||||
echo 3. GhostScript is bundled inside the exe for sharp vector printing
|
||||
echo 4. SumatraPDF (conf\SumatraPDF.exe) is also bundled as fallback
|
||||
echo.
|
||||
echo Note: First run may take a moment as Kivy initializes
|
||||
echo.
|
||||
|
||||
Reference in New Issue
Block a user