Files
proxy-god/scripts/setup_and_build.ps1
Dr Jones 28f00c0887 fix: production-ready build pipeline + audit_device() crash
- fingerprint.py: audit_device() crashed with "cannot unpack non-iterable
  bool" because of a stray `webrtc_ok, _ = ... and True or False` line.
  Replaced with a proper Chrome+Edge registry probe using _WEBRTC_*
  module constants.

- ProxyChainManager.spec: removed the hardcoded absolute run.py path,
  resolve everything relative to SPECPATH so the spec is portable on any
  machine / CI runner. Bundled signup_extension/ and world_map.png as
  data files (these were missing — the runtime would fall back to drawn
  landmasses and the signup browser extension would 404 in the frozen
  build). Added PIL._tkinter_finder hidden import for safety.

- scripts/setup_and_build.ps1: build now uses the spec file instead of
  re-deriving CLI flags. The old `--onefile --windowed --collect-all
  customtkinter` invocation IGNORED the spec and silently dropped the
  bundled data files. Also added explicit $LASTEXITCODE check.

Verified end-to-end: clean PyInstaller build produces a 32MB exe with
signup_extension (8 TOC entries), world_map.png (4), customtkinter
(365) all present.

Co-authored-by: Cursor <cursoragent@cursor.com>
2026-05-21 17:24:55 -07:00

64 lines
2.5 KiB
PowerShell

#Requires -Version 5.1
<#
.SYNOPSIS
After git pull: upgrade pip, install deps, build ProxyChainManager.exe, copy to Desktop, create "Proxy God.lnk".
.DESCRIPTION
Requires Python 3.10+ on PATH (python.exe) or the Windows py launcher (py -3).
Does not auto-install Python; see README for winget one-liner if needed.
#>
$ErrorActionPreference = "Stop"
$root = Split-Path -Parent (Split-Path -Parent $MyInvocation.MyCommand.Path)
Set-Location $root
function Resolve-PythonExe {
if (Get-Command py -ErrorAction SilentlyContinue) {
try {
$out = (& py -3 -c "import sys; print(sys.executable)" 2>$null).Trim()
if ($out -and (Test-Path -LiteralPath $out)) { return $out }
} catch { }
}
$p = Get-Command python.exe -ErrorAction SilentlyContinue
if ($p) { return $p.Source }
throw (
"Python 3.10+ not found (tried 'py -3' and 'python'). Install, then re-run:`n" +
" winget install Python.Python.3.12 --accept-package-agreements --accept-source-agreements`n" +
"Or https://www.python.org/downloads/ (enable 'Add python.exe to PATH')."
)
}
$py = Resolve-PythonExe
Write-Host "Using: $py"
& $py -c "import sys; assert sys.version_info >= (3, 10), 'Need Python 3.10+'; print(sys.version)"
Write-Host "`n== pip (upgrade) =="
& $py -m pip install --upgrade pip
Write-Host "`n== dependencies + PyInstaller =="
& $py -m pip install -r "$root\requirements.txt"
& $py -m pip install pyinstaller
Write-Host "`n== PyInstaller (using ProxyChainManager.spec) =="
# Always build from the spec — it bundles signup_extension/, world_map.png,
# customtkinter assets, and the right hidden imports. Do NOT override with
# CLI flags or the data files will be missing from the .exe.
$spec = Join-Path $root "ProxyChainManager.spec"
if (-not (Test-Path $spec)) { throw "Spec not found: $spec" }
& $py -m PyInstaller --noconfirm --clean $spec
if ($LASTEXITCODE -ne 0) { throw "PyInstaller failed (exit $LASTEXITCODE)" }
$distExe = Join-Path $root "dist\ProxyChainManager.exe"
if (-not (Test-Path $distExe)) {
throw "Build failed: missing $distExe"
}
$desk = [Environment]::GetFolderPath("Desktop")
$deskExe = Join-Path $desk "ProxyChainManager.exe"
Copy-Item -LiteralPath $distExe -Destination $deskExe -Force
Write-Host "Copied: $deskExe"
Write-Host "`n== Desktop shortcut =="
& powershell -NoProfile -ExecutionPolicy Bypass -File "$root\scripts\create_desktop_shortcut.ps1"
Write-Host "`nDone. Launch from Desktop: Proxy God.lnk (or ProxyChainManager.exe)"