From 26a8f1a24c259ff4ca845905d1dabc072e7949bd Mon Sep 17 00:00:00 2001 From: Justin Paul Date: Tue, 30 Jun 2026 16:28:00 -0400 Subject: [PATCH] =?UTF-8?q?CI(windows):=20use=20embeddable=20Python=20(no?= =?UTF-8?q?=20MSI)=20=E2=80=94=20installer=20hit=20error=201603?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 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) Claude-Session: https://claude.ai/code/session_016yT89n4zR4qbrySoSiEyZs --- .gitea/workflows/release.yml | 31 +++++++++++++++++++------------ 1 file changed, 19 insertions(+), 12 deletions(-) diff --git a/.gitea/workflows/release.yml b/.gitea/workflows/release.yml index ce9420d..2b53897 100644 --- a/.gitea/workflows/release.yml +++ b/.gitea/workflows/release.yml @@ -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/')