Files
esp-idf/tools/detect_python.fish
T
Jan Beran 282611e13f feat(tools): deprecate Python 3.10
Bump the minimum-version checks in detect_python.{sh,fish} and
python_version_checker.py, and add Python 3.14 to the interpreters
probed by detect_python.{sh,fish}.
2026-10-02 21:16:13 +08:00

26 lines
952 B
Fish

# This file should be sourced, not executed!
#
# This is a port of detect_python.sh. More information are provided there.
set OLDEST_PYTHON_SUPPORTED_MAJOR 3
set OLDEST_PYTHON_SUPPORTED_MINOR 11
set -x ESP_PYTHON python
for p_cmd in python3 python python3.11 python3.12 python3.13 python3.14;
$p_cmd --version >/dev/null 2>&1; or continue
echo "Checking \"$p_cmd\" ..."
$p_cmd -c "import sys; exit(1) if sys.version_info.major < int(\"$OLDEST_PYTHON_SUPPORTED_MAJOR\") else exit(0);"; or continue
$p_cmd -c "import sys; exit(1) if sys.version_info.minor < int(\"$OLDEST_PYTHON_SUPPORTED_MINOR\") else exit(0);"; or continue
set ESP_PYTHON $p_cmd
break
end
test -n "$ESP_PYTHON"; or echo "Python $OLDEST_PYTHON_SUPPORTED_MAJOR.$OLDEST_PYTHON_SUPPORTED_MINOR+ is not installed! Please see the documentation for how to install it."
test -n "$ESP_PYTHON"; or exit 1
$ESP_PYTHON --version
echo "$ESP_PYTHON has been detected"