This commit is contained in:
2026-08-24 16:40:48 +03:00
parent f7e99516bf
commit 32abb8bf0a
73 changed files with 12364 additions and 9292 deletions
+31 -13
View File
@@ -6,15 +6,40 @@ $ErrorActionPreference = 'Stop'
$here = Split-Path -Parent $MyInvocation.MyCommand.Path
Set-Location $here
function Test-PyInstaller($pyExe, [string[]]$pyArgs) {
$prev = $ErrorActionPreference
$ErrorActionPreference = 'Continue'
try {
& $pyExe @pyArgs -m PyInstaller --version 2>&1 | Out-Null
return $LASTEXITCODE -eq 0
} finally {
$ErrorActionPreference = $prev
}
}
$pyCmd = $null
if (Get-Command python -ErrorAction SilentlyContinue) {
$pyCmd = @('python')
} elseif (Get-Command py -ErrorAction SilentlyContinue) {
$pyCmd = @('py', '-3')
$candidates = @()
if (Get-Command python -ErrorAction SilentlyContinue) { $candidates += ,@('python') }
if (Get-Command py -ErrorAction SilentlyContinue) { $candidates += ,@('py', '-3') }
foreach ($candidate in $candidates) {
$pyExe = $candidate[0]
$pyArgs = @()
if ($candidate.Length -gt 1) {
$pyArgs = $candidate[1..($candidate.Length - 1)]
}
if (Test-PyInstaller $pyExe $pyArgs) {
$pyCmd = $candidate
break
}
}
if (-not $pyCmd) {
Write-Host "[error] Python 3 not found." -ForegroundColor Red
Write-Host "[error] Python 3 with PyInstaller not found." -ForegroundColor Red
Write-Host " Install: py -3 -m pip install pyinstaller" -ForegroundColor Yellow
if ($candidates.Count -gt 0) {
Write-Host " PyInstaller is missing in the Python that runs first (often 'python' != 'py -3')." -ForegroundColor Yellow
}
exit 1
}
@@ -23,14 +48,7 @@ $pyArgs = @()
if ($pyCmd.Length -gt 1) {
$pyArgs = $pyCmd[1..($pyCmd.Length - 1)]
}
$checkArgs = $pyArgs + @('-m', 'PyInstaller', '--version')
try {
& $pyExe @checkArgs *> $null
} catch {
Write-Host "[error] PyInstaller not found. Install with: py -3 -m pip install pyinstaller" -ForegroundColor Red
exit 1
}
Write-Host "[build] using: $pyExe $($pyArgs -join ' ')" -ForegroundColor Cyan
$releaseDir = Join-Path $here 'dist\sshDeploy-gui'
$pyiDist = Join-Path $here 'dist-pyinstaller'