47 lines
1.5 KiB
PowerShell
47 lines
1.5 KiB
PowerShell
# Build Windows portable app (folder with Scribd PDF Downloader.exe)
|
|
# Run from project root: .\build\windows\build.ps1
|
|
|
|
$ErrorActionPreference = "Stop"
|
|
$Root = Resolve-Path (Join-Path $PSScriptRoot "..\..")
|
|
Set-Location $Root
|
|
|
|
Write-Host "=== Scribd PDF Downloader - Windows build ===" -ForegroundColor Cyan
|
|
|
|
if (-not (Test-Path ".venv\Scripts\python.exe")) {
|
|
Write-Host "Creating virtual environment..."
|
|
python -m venv .venv
|
|
}
|
|
|
|
Write-Host "Installing dependencies..."
|
|
& .venv\Scripts\pip install -r requirements-build.txt -q
|
|
|
|
Write-Host "Installing Chromium into package (for bundling)..."
|
|
$env:PLAYWRIGHT_BROWSERS_PATH = "0"
|
|
& .venv\Scripts\playwright install chromium
|
|
|
|
Write-Host "Running PyInstaller..."
|
|
& .venv\Scripts\pyinstaller --noconfirm --clean "build\scribd_gui.spec"
|
|
|
|
$Dist = Join-Path $Root "dist\Scribd PDF Downloader"
|
|
if (-not (Test-Path $Dist)) {
|
|
throw "Build failed: dist folder not found."
|
|
}
|
|
|
|
Copy-Item "config.ini" $Dist -Force -ErrorAction SilentlyContinue
|
|
|
|
$Zip = Join-Path $Root "dist\Scribd-PDF-Downloader-Windows.zip"
|
|
if (Test-Path $Zip) { Remove-Item $Zip -Force }
|
|
Start-Sleep -Seconds 2
|
|
try {
|
|
Compress-Archive -Path $Dist -DestinationPath $Zip -Force
|
|
} catch {
|
|
Write-Host "Zip skipped (copy the dist folder instead): $_" -ForegroundColor Yellow
|
|
}
|
|
|
|
Write-Host ""
|
|
Write-Host "Build complete!" -ForegroundColor Green
|
|
Write-Host " App folder: $Dist"
|
|
Write-Host " Zip archive: $Zip"
|
|
Write-Host ""
|
|
Write-Host ('Run: "' + (Join-Path $Dist 'Scribd PDF Downloader.exe') + '"')
|