Skip to content

Commit f0a5e52

Browse files
committed
Restore python-setup/check_python12.ps1
I think we can delete this logic too, but let's deal with that in a separate PR
1 parent e0bc6b7 commit f0a5e52

File tree

1 file changed

+19
-0
lines changed

1 file changed

+19
-0
lines changed

python-setup/check_python12.ps1

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
2+
#! /usr/bin/pwsh
3+
4+
# If we are running greater than or equal to python 3.12, change py to run version 3.11
5+
Write-Host "Checking python version"
6+
if ((py -3 -c "import sys; print(0 if sys.version_info >= (3, 12) else 1)") -eq "0") {
7+
Write-Host "python 3.12+ detected, setting PY_PYTHON3=3.11"
8+
# First make sure we have python 3.11 installed
9+
py -3.11 -c "import imp"
10+
if ($LASTEXITCODE -eq 0) {
11+
Write-Host "python 3.11 detected, using this version instead of 3.12+."
12+
Write-Output "PY_PYTHON3=3.11" | Out-File -FilePath $Env:GITHUB_ENV -Encoding utf8 -Append
13+
} else {
14+
Write-Host "FAILURE: Python 3.12+ is not supported, and Python 3.11 could not be detected on the system. Please install Python 3.11."
15+
exit 1
16+
}
17+
} else {
18+
Write-Host "python 3.12+ not detected, not making any changes."
19+
}

0 commit comments

Comments
 (0)