From 6e0d0cba8841e2057c93c196a8f5eeeecef6f446 Mon Sep 17 00:00:00 2001 From: Simone Date: Thu, 14 May 2026 22:51:22 +0200 Subject: [PATCH] ci(lint): probe multiple Python launcher locations for SYSTEM runner act_runner SYSTEM context may not have py.exe or python.exe in PATH. Try a list of common install paths (C:\Python3XX, Program Files, LocalAppData) and allow override via CI_PYTHON_LAUNCHER env var. --- .gitea/workflows/lint.yml | 36 ++++++++++++++++++++++++++++++++++-- 1 file changed, 34 insertions(+), 2 deletions(-) diff --git a/.gitea/workflows/lint.yml b/.gitea/workflows/lint.yml index caf3b0e..ec5979f 100644 --- a/.gitea/workflows/lint.yml +++ b/.gitea/workflows/lint.yml @@ -108,8 +108,40 @@ jobs: if (Test-Path $env:VENV_DIR) { Remove-Item $env:VENV_DIR -Recurse -Force } - $launcher = (Get-Command py.exe -ErrorAction Stop).Source - & $launcher -3.11 -m venv $env:VENV_DIR + + # Find a usable Python launcher. act_runner runs as SYSTEM and may + # not have py.exe / python.exe in PATH; try common locations. + # Override via $env:CI_PYTHON_LAUNCHER if installed elsewhere. + $candidates = @() + if ($env:CI_PYTHON_LAUNCHER) { $candidates += $env:CI_PYTHON_LAUNCHER } + $candidates += @( + 'py.exe', + 'python.exe', + 'C:\Python311\python.exe', + 'C:\Python312\python.exe', + 'C:\Python313\python.exe', + "$env:LOCALAPPDATA\Programs\Python\Python311\python.exe", + "$env:LOCALAPPDATA\Programs\Python\Python312\python.exe", + 'C:\Program Files\Python311\python.exe', + 'C:\Program Files\Python312\python.exe', + 'C:\Program Files\Python313\python.exe' + ) + $launcher = $null + foreach ($c in $candidates) { + $cmd = Get-Command $c -ErrorAction SilentlyContinue + if ($cmd) { $launcher = $cmd.Source; break } + } + if (-not $launcher) { + throw "No Python launcher found. Install Python 3.11+ system-wide or set CI_PYTHON_LAUNCHER. Tried: $($candidates -join ', ')" + } + Write-Host "Bootstrapping venv with: $launcher" + + if ($launcher -like '*py.exe') { + & $launcher -3.11 -m venv $env:VENV_DIR + } + else { + & $launcher -m venv $env:VENV_DIR + } if ($LASTEXITCODE -ne 0) { throw "venv creation failed" } }