Add PyInstaller packaging (--onedir) as alternative to pyw launch

Avoids the cmd.exe flash from double-clicking run_desktop.bat and
gives a proper double-click .exe like VersaGUI.exe. Must be deployed
locally (%LOCALAPPDATA%) -- Windows silently refuses to load the
_internal DLLs when the .exe sits on the Z: network share, no error
shown. build_and_deploy.ps1 handles build + local copy in one step.
This commit is contained in:
cjjohn 2026-08-05 08:04:38 +02:00
parent 6227903ebd
commit 50658107d5
4 changed files with 99 additions and 0 deletions

26
build_and_deploy.ps1 Normal file
View file

@ -0,0 +1,26 @@
# Baut VersaPadViewer.exe (PyInstaller --onedir) und kopiert das Ergebnis
# nach lokal (C:\Users\<user>\AppData\Local\VersaPadViewer).
#
# WICHTIG: Muss lokal laufen, NICHT direkt vom Netzlaufwerk (Z:\Git\...) --
# Windows blockiert das Nachladen der PyInstaller-_internal-DLLs von einem
# Netzwerkpfad (SMB-Share) ohne jede Fehlermeldung, der Prozess startet
# einfach nie. Deshalb bauen wir hier (Quelle darf auf Z: liegen) und
# kopieren das fertige Bundle danach nach C:.
$ErrorActionPreference = "Stop"
$projectDir = $PSScriptRoot
$localDir = "$env:LOCALAPPDATA\VersaPadViewer"
Push-Location $projectDir
try {
py -m PyInstaller --windowed --onedir --name VersaPadViewer desktop_viewer.py --noconfirm
} finally {
Pop-Location
}
if (Test-Path $localDir) {
Remove-Item $localDir -Recurse -Force
}
Copy-Item "$projectDir\dist\VersaPadViewer" -Destination $localDir -Recurse
Write-Host "Fertig: $localDir\VersaPadViewer.exe"