Tools: Fix silent failure about the incompatible Python

pull/8430/head
Roland Dobai 2022-02-15 18:36:46 +01:00
rodzic 0d03c17ab2
commit a93e372364
9 zmienionych plików z 25 dodań i 9 usunięć

Wyświetl plik

@ -17,6 +17,9 @@ if not "%MISSING_REQUIREMENTS%" == "" goto :__error_missing_requirements
set IDF_PATH=%~dp0
set IDF_PATH=%IDF_PATH:~0,-1%
echo Checking Python compatibility
python.exe "%IDF_PATH%\tools\python_version_checker.py"
set "IDF_TOOLS_PY_PATH=%IDF_PATH%\tools\idf_tools.py"
set "IDF_TOOLS_JSON_PATH=%IDF_PATH%\tools\tools.json"
set "IDF_TOOLS_EXPORT_CMD=%IDF_PATH%\export.bat"

Wyświetl plik

@ -11,6 +11,9 @@ function __main
echo "Detecting the Python interpreter"
source "$IDF_PATH"/tools/detect_python.fish
echo "Checking Python compatibility"
"$ESP_PYTHON" "$IDF_PATH"/tools/python_version_checker.py
echo "Adding ESP-IDF tools to PATH..."
# Call idf_tools.py to export tool paths
set -x IDF_TOOLS_EXPORT_CMD "$IDF_PATH"/export.fish

Wyświetl plik

@ -6,6 +6,9 @@ $IDF_PATH = $PSScriptRoot
Write-Output "Setting IDF_PATH: $IDF_PATH"
$env:IDF_PATH = $IDF_PATH
Write-Output "Checking Python compatibility"
python $IDF_PATH/tools/python_version_checker.py
Write-Output "Adding ESP-IDF tools to PATH..."
$OLD_PATH = $env:PATH.split($S) | Select-Object -Unique # array without duplicates
# using idf_tools.py to get $envars_array to set

Wyświetl plik

@ -87,6 +87,9 @@ __main() {
echo "Detecting the Python interpreter"
. "${IDF_PATH}/tools/detect_python.sh"
echo "Checking Python compatibility"
"$ESP_PYTHON" "${IDF_PATH}/tools/python_version_checker.py"
__verbose "Adding ESP-IDF tools to PATH..."
# Call idf_tools.py to export tool paths
export IDF_TOOLS_EXPORT_CMD=${IDF_PATH}/export.sh

Wyświetl plik

@ -7,6 +7,9 @@ set -x IDF_PATH $basedir
echo "Detecting the Python interpreter"
source "$IDF_PATH"/tools/detect_python.fish
echo "Checking Python compatibility"
"$ESP_PYTHON" "$IDF_PATH"/tools/python_version_checker.py
set TARGETS ("$ESP_PYTHON" "$IDF_PATH"/tools/install_util.py extract targets $argv) || exit 1
echo "Installing ESP-IDF tools"

Wyświetl plik

@ -10,6 +10,9 @@ export IDF_PATH
echo "Detecting the Python interpreter"
. "${IDF_PATH}/tools/detect_python.sh"
echo "Checking Python compatibility"
"${ESP_PYTHON}" "${IDF_PATH}/tools/python_version_checker.py"
TARGETS=`"${ESP_PYTHON}" "${IDF_PATH}/tools/install_util.py" extract targets "$@"`
echo "Installing ESP-IDF tools"

Wyświetl plik

@ -109,6 +109,7 @@ tools/ldgen/test/test_output_commands.py
tools/mass_mfg/mfg_gen.py
tools/mkdfu.py
tools/mkuf2.py
tools/python_version_checker.py
tools/set-submodules-to-github.sh
tools/test_apps/system/no_embedded_paths/check_for_file_paths.py
tools/test_idf_monitor/run_test_idf_monitor.py

Wyświetl plik

@ -10,15 +10,6 @@
import argparse
from itertools import chain
try:
import python_version_checker
# check the Python version before it will fail with an exception on syntax or package incompatibility.
python_version_checker.check()
except RuntimeError as e:
print(e)
raise SystemExit(1)
def action_extract_features(args: str) -> None:
"""

6
tools/python_version_checker.py 100644 → 100755
Wyświetl plik

@ -1,3 +1,5 @@
#!/usr/bin/env python
#
# SPDX-FileCopyrightText: 2021-2022 Espressif Systems (Shanghai) CO LTD
#
# SPDX-License-Identifier: Apache-2.0
@ -37,3 +39,7 @@ def check(): # type: () -> None
_ver_to_str(OLDEST_PYTHON_SUPPORTED), _ver_to_str(sys.version_info[:3])
)
)
if __name__ == '__main__':
check()