Files
P4-USB-transfer/nand_xfer/build_gui.ps1
T

19 lines
804 B
PowerShell
Raw Normal View History

2026-10-13 21:54:50 +08:00
$ErrorActionPreference = 'Stop'
$project = $PSScriptRoot
$venv = Join-Path $project '.venv_gui'
$py = Join-Path $venv 'Scripts\python.exe'
Push-Location $project
try {
if (-not (Test-Path -LiteralPath $py)) {
& py -3 -m venv $venv
if ($LASTEXITCODE -ne 0) { throw "venv failed: $LASTEXITCODE" }
}
& $py -m pip install -q --upgrade pip pyinstaller pyserial
if ($LASTEXITCODE -ne 0) { throw "pip failed: $LASTEXITCODE" }
& $py -m PyInstaller --noconfirm --clean --workpath gui_build --distpath dist nand_put_gui.spec
if ($LASTEXITCODE -ne 0) { throw "PyInstaller failed: $LASTEXITCODE" }
$exe = Join-Path $project 'dist\NAND_Xfer.exe'
if (-not (Test-Path -LiteralPath $exe)) { throw "Missing $exe" }
Write-Host "GUI exe: $exe"
} finally { Pop-Location }