CI(windows): use embeddable Python (no MSI) — installer hit error 1603
The python.org MSI returns 1603 on this runner (half-registered state from prior install attempts). Switch to the embeddable zip + get-pip: no MSI, no admin, no registry — self-contained in LOCALAPPDATA. Falls through to a pre-installed python if the runner already has one. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_016yT89n4zR4qbrySoSiEyZs
This commit is contained in:
@@ -17,23 +17,30 @@ jobs:
|
||||
shell: pwsh
|
||||
run: |
|
||||
$ErrorActionPreference = "Stop"
|
||||
# Use a pre-installed Python if the runner has one; otherwise set up a
|
||||
# self-contained embeddable Python (no MSI, no admin, no registry).
|
||||
$py = "python"
|
||||
if (-not (Get-Command python -ErrorAction SilentlyContinue)) {
|
||||
Write-Host "Python not found; installing 3.12 to a fixed dir (no admin needed)..."
|
||||
$url = "https://www.python.org/ftp/python/3.12.7/python-3.12.7-amd64.exe"
|
||||
Invoke-WebRequest -Uri $url -OutFile "$env:TEMP\py.exe"
|
||||
$dir = "$env:LOCALAPPDATA\Python312"
|
||||
$p = Start-Process -Wait -PassThru -FilePath "$env:TEMP\py.exe" `
|
||||
-ArgumentList "/quiet","TargetDir=$dir","PrependPath=1","Include_test=0"
|
||||
Write-Host "installer exit code: $($p.ExitCode)"
|
||||
$dir = "$env:LOCALAPPDATA\obdash-python"
|
||||
if (-not (Test-Path "$dir\python.exe")) {
|
||||
throw "python.exe not found at $dir after install (exit $($p.ExitCode))"
|
||||
Write-Host "Setting up embeddable Python 3.12 at $dir ..."
|
||||
$zip = "$env:TEMP\pyembed.zip"
|
||||
Invoke-WebRequest "https://www.python.org/ftp/python/3.12.7/python-3.12.7-embed-amd64.zip" -OutFile $zip
|
||||
if (Test-Path $dir) { Remove-Item -Recurse -Force $dir }
|
||||
Expand-Archive $zip -DestinationPath $dir -Force
|
||||
# enable site-packages so pip-installed packages import
|
||||
$pth = Get-ChildItem "$dir\python*._pth" | Select-Object -First 1
|
||||
(Get-Content $pth) -replace '^#\s*import site','import site' | Set-Content $pth
|
||||
Invoke-WebRequest "https://bootstrap.pypa.io/get-pip.py" -OutFile "$dir\get-pip.py"
|
||||
& "$dir\python.exe" "$dir\get-pip.py" --no-warn-script-location
|
||||
}
|
||||
$py = "$dir\python.exe"
|
||||
$env:Path = "$dir;$dir\Scripts;$env:Path"
|
||||
}
|
||||
python --version
|
||||
python -m pip install --upgrade pip
|
||||
pip install -r requirements-gui.txt pyinstaller
|
||||
pyinstaller --noconfirm --onefile --windowed --name OBDash --add-data "profiles;profiles" run_gui.py
|
||||
& $py --version
|
||||
& $py -m pip install --upgrade pip
|
||||
& $py -m pip install -r requirements-gui.txt pyinstaller
|
||||
& $py -m PyInstaller --noconfirm --onefile --windowed --name OBDash --add-data "profiles;profiles" run_gui.py
|
||||
Copy-Item dist/OBDash.exe OBDash-windows.exe
|
||||
- name: Publish to release
|
||||
if: startsWith(github.ref, 'refs/tags/')
|
||||
|
||||
Reference in New Issue
Block a user