fix(capabilities): fall back to python3

This commit is contained in:
fraujulian committed 2026-09-18 11:59:04 +02:00
1 parent 25a9579eee
commit 72338270d0
1 file changed
+7 -4
+7 -4
View File
@@ -9,11 +9,14 @@ function Version-AtLeast([string]$version, [version]$minimum) { try { return ([v
function Check-Version([string]$name, [string]$version, [version]$minimum) { if (Version-AtLeast $version $minimum) { Pass "$name $version (minimum $minimum)" } else { Fail "$name $version is below minimum $minimum" } }
Check-Version 'PowerShell' $PSVersionTable.PSVersion.ToString() ([version]'5.1')
Require-Command jq; Require-Command python
if (Get-Command python -ErrorAction SilentlyContinue) {
$pythonVersion = (& python --version 2>$null | Select-Object -First 1) -replace '^Python\s+', ''
if ($LASTEXITCODE -eq 0) { Check-Version 'Python' $pythonVersion ([version]'3.11') } else { Fail 'Python 3.11 or newer is required' }
Require-Command jq
$pythonVersion = $null
foreach ($python in @('python', 'python3')) {
if (-not (Get-Command $python -ErrorAction SilentlyContinue)) { continue }
$candidate = (& $python --version 2>$null | Select-Object -First 1) -replace '^Python\s+', ''
if ($LASTEXITCODE -eq 0) { $pythonVersion = $candidate; break }
}
if ($null -ne $pythonVersion) { Check-Version 'Python' $pythonVersion ([version]'3.11') } else { Fail 'Python 3.11 or newer is required' }
if ($failed) { Write-Error 'Capability check: FAIL'; exit 1 }
Write-Output 'Capability check: PASS'