-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathbuild_exe.ps1
More file actions
40 lines (33 loc) · 1006 Bytes
/
Copy pathbuild_exe.ps1
File metadata and controls
40 lines (33 loc) · 1006 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
# Build a standalone Windows executable for Python BackUp (backup_v2.py).
#
# pip install -r requirements-dev.txt
# .\build_exe.ps1
#
# Output: dist\PythonBackUp.exe (single-file, no console window).
param(
[switch]$SkipDesktopCopy
)
$ErrorActionPreference = "Stop"
Set-Location $PSScriptRoot
Get-Process -Name "PythonBackUp" -ErrorAction SilentlyContinue | Stop-Process -Force
Start-Sleep -Milliseconds 500
python -m PyInstaller `
--noconfirm `
--clean `
--onefile `
--windowed `
--name PythonBackUp `
--hidden-import backup_theme `
backup_v2.py
$exe = Join-Path $PSScriptRoot "dist\PythonBackUp.exe"
if (-not (Test-Path $exe)) {
throw "Build failed - $exe not found"
}
if (-not $SkipDesktopCopy) {
$desktop = [Environment]::GetFolderPath("Desktop")
$dest = Join-Path $desktop "PythonBackUp.exe"
Copy-Item -Path $exe -Destination $dest -Force
Write-Host "Copied to desktop: $dest"
}
Write-Host ""
Write-Host "Done. Executable is at: $exe"