ci: install Python for Qt setup on Windows
Some checks failed
Build Windows Release / Build Windows x64 Release (MSVC + Qt) (push) Failing after 50s

This commit is contained in:
luochen570
2026-05-30 22:01:04 +08:00
parent 0717efe807
commit 9bd4433498

View File

@@ -67,9 +67,23 @@ jobs:
$pythonArgs = @('-3')
} else {
$python = Get-Command python -ErrorAction SilentlyContinue
if (-not $python) { throw 'Python is required to install Qt with aqtinstall, but py/python was not found on PATH.' }
if ($python) {
$pythonExe = $python.Source
$pythonArgs = @()
} else {
$pythonRoot = Join-Path $env:RUNNER_TEMP 'python312'
$pythonExe = Join-Path $pythonRoot 'python.exe'
if (-not (Test-Path $pythonExe)) {
$installer = Join-Path $env:RUNNER_TEMP 'python-installer.exe'
$pythonUrl = 'https://www.python.org/ftp/python/3.12.10/python-3.12.10-amd64.exe'
Write-Host "Downloading Python from $pythonUrl"
Invoke-WebRequest -Uri $pythonUrl -OutFile $installer
& $installer /quiet InstallAllUsers=0 TargetDir=$pythonRoot Include_pip=1 Include_test=0 PrependPath=0
if ($LASTEXITCODE -ne 0) { throw "Python installer failed, exit code: $LASTEXITCODE" }
}
if (-not (Test-Path $pythonExe)) { throw "Python installation finished but python.exe was not found: $pythonExe" }
$pythonArgs = @()
}
}
& $pythonExe @pythonArgs -m pip install --user --upgrade aqtinstall