Use Python 3.12 to run the yapf formatter if no lower version is available (#164807)
Python 3.12 still provides the dependencies required by yapf (such as lib2to3)
This commit is contained in:
parent
647e5a1407
commit
c0e6f90652
@ -43,12 +43,14 @@ if command -v python3.10 &> /dev/null; then
|
|||||||
PYTHON_EXEC="python3.10"
|
PYTHON_EXEC="python3.10"
|
||||||
elif command -v python3.11 &> /dev/null; then
|
elif command -v python3.11 &> /dev/null; then
|
||||||
PYTHON_EXEC="python3.11"
|
PYTHON_EXEC="python3.11"
|
||||||
|
elif command -v python3.12 &> /dev/null; then
|
||||||
|
PYTHON_EXEC="python3.12"
|
||||||
else
|
else
|
||||||
python3 -c "
|
python3 -c "
|
||||||
import sys
|
import sys
|
||||||
version = sys.version_info
|
version = sys.version_info
|
||||||
if (version.major, version.minor) > (3, 11):
|
if (version.major, version.minor) > (3, 12):
|
||||||
print(f'Error: The yapf Python formatter requires Python version 3.11 or '
|
print(f'Error: The yapf Python formatter requires Python version 3.12 or '
|
||||||
f'earlier. The installed python3 version is '
|
f'earlier. The installed python3 version is '
|
||||||
f'{version.major}.{version.minor}.',
|
f'{version.major}.{version.minor}.',
|
||||||
file=sys.stderr)
|
file=sys.stderr)
|
||||||
|
Loading…
x
Reference in New Issue
Block a user