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
This commit is contained in:
Ivan Grokhotkov 2021-10-06 11:06:22 +02:00
parent 028a4c93ff
commit 999abf403e
2 changed files with 14 additions and 15 deletions

View File

@ -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.

View File

@ -22,11 +22,11 @@ set TARGETS="all"
if NOT "%1"=="" set TARGETS=%*
echo Installing ESP-IDF tools
python.exe %IDF_PATH%\tools\idf_tools.py install --targets=%TARGETS%
python.exe "%IDF_PATH%\tools\idf_tools.py" install --targets=%TARGETS%
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: