From d0b2d5ec95113fc7c9ec17787e16d30afb8aebf5 Mon Sep 17 00:00:00 2001 From: Renz Christian Bagaporo Date: Tue, 12 Mar 2019 13:31:44 +0800 Subject: [PATCH] cmake: Fix for Python files executed directly, not via PYTHON variable A problem if the Python interpreter used for idf.py (or set via PYTHON variable) didn't match "/usr/bin/env python" (or the associated executable for .py files, on Windows). Closes https://github.com/espressif/esp-idf/issues/3160 Possibly also fix for https://github.com/espressif/esp-idf/issues/2936 Adds build system test to catch any future direct execution of Python in the standard build process. --- components/esptool_py/project_include.cmake | 6 +++--- components/ulp/cmake/CMakeLists.txt | 2 +- tools/cmake/ldgen.cmake | 2 +- 3 files changed, 5 insertions(+), 5 deletions(-) diff --git a/components/esptool_py/project_include.cmake b/components/esptool_py/project_include.cmake index ff6da5b8a2..2d05f11a73 100644 --- a/components/esptool_py/project_include.cmake +++ b/components/esptool_py/project_include.cmake @@ -5,9 +5,9 @@ endif() # Set some global esptool.py variables # # Many of these are read when generating flash_app_args & flash_project_args -set(ESPTOOLPY "${CMAKE_CURRENT_LIST_DIR}/esptool/esptool.py" --chip esp32) -set(ESPSECUREPY "${CMAKE_CURRENT_LIST_DIR}/esptool/espsecure.py") -set(ESPEFUSEPY "${CMAKE_CURRENT_LIST_DIR}/esptool/espefuse.py") +set(ESPTOOLPY ${PYTHON} "${CMAKE_CURRENT_LIST_DIR}/esptool/esptool.py" --chip esp32) +set(ESPSECUREPY ${PYTHON} "${CMAKE_CURRENT_LIST_DIR}/esptool/espsecure.py") +set(ESPEFUSEPY ${PYTHON} "${CMAKE_CURRENT_LIST_DIR}/esptool/espefuse.py") set(ESPFLASHMODE ${CONFIG_ESPTOOLPY_FLASHMODE}) set(ESPFLASHFREQ ${CONFIG_ESPTOOLPY_FLASHFREQ}) diff --git a/components/ulp/cmake/CMakeLists.txt b/components/ulp/cmake/CMakeLists.txt index b4cfcd4baf..49654e84f4 100644 --- a/components/ulp/cmake/CMakeLists.txt +++ b/components/ulp/cmake/CMakeLists.txt @@ -28,7 +28,7 @@ if(NOT as_version STREQUAL as_supported_version) the toolchain, or proceed at your own risk.") endif() -set(ULP_MAP_GEN ${IDF_PATH}/components/ulp/esp32ulp_mapgen.py) +set(ULP_MAP_GEN ${PYTHON} ${IDF_PATH}/components/ulp/esp32ulp_mapgen.py) set(ULP_LD_TEMPLATE ${IDF_PATH}/components/ulp/ld/esp32.ulp.ld) get_filename_component(sdkconfig_dir ${SDKCONFIG} DIRECTORY) diff --git a/tools/cmake/ldgen.cmake b/tools/cmake/ldgen.cmake index 8cc277986e..6a00eacfe6 100644 --- a/tools/cmake/ldgen.cmake +++ b/tools/cmake/ldgen.cmake @@ -53,7 +53,7 @@ function(ldgen_process_template template output) # Create command to invoke the linker script generator tool. add_custom_command( OUTPUT ${output} - COMMAND ${IDF_PATH}/tools/ldgen/ldgen.py + COMMAND ${PYTHON} ${IDF_PATH}/tools/ldgen/ldgen.py --config ${SDKCONFIG} --fragments "$,\t>" --input ${template} -- 2.40.0