From 5132d6ab5ceb6f2cb6c3f8497ec2fc84a607a44a Mon Sep 17 00:00:00 2001 From: Ivan Grokhotkov Date: Wed, 6 Oct 2021 11:06:22 +0200 Subject: [PATCH] tools: {install, export}.bat: fix path quoting Also includes fix for DOSKEY definitions. Closes https://github.com/espressif/esp-idf/issues/7605 Closes https://github.com/espressif/esp-idf/issues/7927 --- export.bat | 25 ++++++++++++------------- install.bat | 4 ++-- 2 files changed, 14 insertions(+), 15 deletions(-) diff --git a/export.bat b/export.bat index cba8e4206d..ec7a50eec0 100644 --- a/export.bat +++ b/export.bat @@ -14,21 +14,14 @@ if %errorlevel% neq 0 set "MISSING_REQUIREMENTS=%MISSING_REQUIREMENTS% git" if not "%MISSING_REQUIREMENTS%" == "" goto :error_missing_requirements -set PREFIX=python.exe %IDF_PATH% -DOSKEY idf.py=%PREFIX%\tools\idf.py $* -DOSKEY esptool.py=%PREFIX%\components\esptool_py\esptool\esptool.py $* -DOSKEY espefuse.py=%PREFIX%\components\esptool_py\esptool\espefuse.py $* -DOSKEY otatool.py=%PREFIX%\components\app_update\otatool.py $* -DOSKEY parttool.py=%PREFIX%\components\partition_table\parttool.py $* - :: Infer IDF_PATH from script location set IDF_PATH=%~dp0 set IDF_PATH=%IDF_PATH:~0,-1% -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 -set IDF_TOOLS_INSTALL_CMD=%IDF_PATH%\install.bat +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" +set "IDF_TOOLS_INSTALL_CMD=%IDF_PATH%\install.bat" echo Setting IDF_PATH: %IDF_PATH% echo. @@ -38,7 +31,7 @@ echo Adding ESP-IDF tools to PATH... :: It is possible to do this without a temporary file (running idf_tools.py from for /r command), :: but that way it is impossible to get the exit code of idf_tools.py. set "IDF_TOOLS_EXPORTS_FILE=%TEMP%\idf_export_vars.tmp" -python.exe %IDF_PATH%\tools\idf_tools.py export --format key-value >"%IDF_TOOLS_EXPORTS_FILE%" +python.exe "%IDF_PATH%\tools\idf_tools.py" export --format key-value >"%IDF_TOOLS_EXPORTS_FILE%" if %errorlevel% neq 0 goto :end for /f "usebackq tokens=1,2 eol=# delims==" %%a in ("%IDF_TOOLS_EXPORTS_FILE%") do ( @@ -51,8 +44,14 @@ call set PATH_ADDITIONS=%%PATH:%OLD_PATH%=%% if "%PATH_ADDITIONS%"=="" call :print_nothing_added if not "%PATH_ADDITIONS%"=="" echo %PATH_ADDITIONS:;=&echo. % +DOSKEY idf.py=python.exe "%IDF_PATH%\tools\idf.py" $* +DOSKEY esptool.py=python.exe "%IDF_PATH%\components\esptool_py\esptool\esptool.py" $* +DOSKEY espefuse.py=python.exe "%IDF_PATH%\components\esptool_py\esptool\espefuse.py" $* +DOSKEY otatool.py=python.exe "%IDF_PATH%\components\app_update\otatool.py" $* +DOSKEY parttool.py=python.exe "%IDF_PATH%\components\partition_table\parttool.py" $* + echo Checking if Python packages are up to date... -python.exe %IDF_PATH%\tools\check_python_dependencies.py +python.exe "%IDF_PATH%\tools\check_python_dependencies.py" if %errorlevel% neq 0 goto :end echo. diff --git a/install.bat b/install.bat index 8b0958d8f4..49d57b8b3d 100644 --- a/install.bat +++ b/install.bat @@ -19,11 +19,11 @@ set IDF_PATH=%~dp0 set IDF_PATH=%IDF_PATH:~0,-1% echo Installing ESP-IDF tools -python.exe %IDF_PATH%\tools\idf_tools.py install +python.exe "%IDF_PATH%\tools\idf_tools.py" install if %errorlevel% neq 0 goto :end echo Setting up Python environment -python.exe %IDF_PATH%\tools\idf_tools.py install-python-env +python.exe "%IDF_PATH%\tools\idf_tools.py" install-python-env if %errorlevel% neq 0 goto :end echo All done! You can now run: