Release ZipBundler 1.0.0 with guided recompression and complete Windows build
This commit is contained in:
@@ -1,6 +1,7 @@
|
||||
param(
|
||||
[switch]$Clean,
|
||||
[switch]$SkipGhostscriptBundle
|
||||
[switch]$SkipGhostscriptBundle,
|
||||
[switch]$SkipDependencyInstall
|
||||
)
|
||||
|
||||
$ErrorActionPreference = "Stop"
|
||||
@@ -21,14 +22,27 @@ if (-not (Test-Path -LiteralPath $SplashImage)) {
|
||||
}
|
||||
|
||||
if ($Clean) {
|
||||
Remove-Item -LiteralPath (Join-Path $ProjectRoot "build") -Recurse -Force -ErrorAction SilentlyContinue
|
||||
Remove-Item -LiteralPath (Join-Path $ProjectRoot "dist") -Recurse -Force -ErrorAction SilentlyContinue
|
||||
Remove-Item -LiteralPath (Join-Path $ProjectRoot "$AppName.spec") -Force -ErrorAction SilentlyContinue
|
||||
foreach ($relativePath in @("build", "dist", "$AppName.spec")) {
|
||||
$targetPath = [IO.Path]::GetFullPath((Join-Path $ProjectRoot $relativePath))
|
||||
if (-not $targetPath.StartsWith($ProjectRoot.TrimEnd('\') + '\', [StringComparison]::OrdinalIgnoreCase)) {
|
||||
throw "Percorso di pulizia esterno al progetto: $targetPath"
|
||||
}
|
||||
if (Test-Path -LiteralPath $targetPath) {
|
||||
$targetItem = Get-Item -LiteralPath $targetPath -Force
|
||||
if ($targetItem.Attributes -band [IO.FileAttributes]::ReparsePoint) {
|
||||
throw "Pulizia non consentita su collegamenti: $targetPath"
|
||||
}
|
||||
Remove-Item -LiteralPath $targetPath -Recurse -Force
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
python -m pip install --upgrade pip
|
||||
python -m pip install -r requirements.txt
|
||||
python -m pip install --upgrade pyinstaller
|
||||
if (-not $SkipDependencyInstall) {
|
||||
python -m pip install -r requirements.txt
|
||||
if ($LASTEXITCODE -ne 0) { throw "Installazione dipendenze non riuscita." }
|
||||
python -m pip install pyinstaller
|
||||
if ($LASTEXITCODE -ne 0) { throw "Installazione PyInstaller non riuscita." }
|
||||
}
|
||||
|
||||
$argsList = @(
|
||||
"--noconfirm",
|
||||
@@ -38,12 +52,14 @@ $argsList = @(
|
||||
"--name", $AppName,
|
||||
"--splash", $SplashImage,
|
||||
"--add-data", "$SplashImage;assets",
|
||||
"--collect-all", "customtkinter",
|
||||
"--hidden-import", "customtkinter",
|
||||
"--hidden-import", "PIL._tkinter_finder",
|
||||
"--hidden-import", "fitz",
|
||||
"--hidden-import", "win32com",
|
||||
"--hidden-import", "win32com.client",
|
||||
"--hidden-import", "pythoncom"
|
||||
"--hidden-import", "pythoncom",
|
||||
"--hidden-import", "pywintypes"
|
||||
)
|
||||
|
||||
if (-not $SkipGhostscriptBundle) {
|
||||
@@ -55,7 +71,7 @@ if (-not $SkipGhostscriptBundle) {
|
||||
$argsList += @("--add-data", "$ghostscriptRoot;ghostscript")
|
||||
}
|
||||
else {
|
||||
Write-Warning "Ghostscript non trovato nel PATH. Il programma usera Ghostscript solo se installato sul PC di destinazione."
|
||||
throw "Ghostscript non trovato nel PATH: impossibile creare la build completa."
|
||||
}
|
||||
}
|
||||
else {
|
||||
@@ -65,6 +81,7 @@ else {
|
||||
$argsList += $EntryPoint
|
||||
|
||||
python -m PyInstaller @argsList
|
||||
if ($LASTEXITCODE -ne 0) { throw "PyInstaller non ha completato la build." }
|
||||
|
||||
$exePath = Join-Path $ProjectRoot "dist\$AppName.exe"
|
||||
if (Test-Path -LiteralPath $exePath) {
|
||||
|
||||
Reference in New Issue
Block a user