tools: Prefer python3 during install and export

Install and export script should work on systems without "python"
executable.

Closes https://github.com/espressif/esp-idf/pull/6471

Closes https://github.com/espressif/esp-idf/issues/6532

Related to https://github.com/espressif/esp-idf/issues/6421 and
https://github.com/espressif/arduino-esp32/issues/4717
This commit is contained in:
Roland Dobai
2021-02-02 13:20:09 +01:00
parent e22de81955
commit 47f67f8b81
11 changed files with 90 additions and 100 deletions

View File

@@ -79,11 +79,14 @@ idf_export_main() {
old_path="$PATH"
echo "Detecting the Python interpreter"
. "${IDF_PATH}/tools/detect_python.sh"
echo "Adding ESP-IDF tools to PATH..."
# Call idf_tools.py to export tool paths
export IDF_TOOLS_EXPORT_CMD=${IDF_PATH}/export.sh
export IDF_TOOLS_INSTALL_CMD=${IDF_PATH}/install.sh
idf_exports=$("${IDF_PATH}/tools/idf_tools.py" export) || return 1
idf_exports=$("$ESP_PYTHON" "${IDF_PATH}/tools/idf_tools.py" export) || return 1
eval "${idf_exports}"
echo "Using Python interpreter in $(which python)"
@@ -125,6 +128,7 @@ idf_export_main() {
unset path_entry
unset IDF_ADD_PATHS_EXTRAS
unset idf_exports
unset ESP_PYTHON
# Not unsetting IDF_PYTHON_ENV_PATH, it can be used by IDF build system
# to check whether we are using a private Python environment