diff --git a/scripts/commands/check-capabilities.ps1 b/scripts/commands/check-capabilities.ps1 index 8151ef9..a9e0075 100644 --- a/scripts/commands/check-capabilities.ps1 +++ b/scripts/commands/check-capabilities.ps1 @@ -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'