Skip to content

Commit

Permalink
build: improve reliability of find_python.cmd script
Browse files Browse the repository at this point in the history
The path of the Python executable might contain white spaces. Handle
this when the `check-python` function is called.

Fixes: #42801
  • Loading branch information
lpinca committed Apr 21, 2022
1 parent c6547c5 commit 2faf997
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions tools/msvs/find_python.cmd
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@ exit /b 1

:found-python
echo Python found in %p%\python.exe
call :check-python %p%\python.exe
call :check-python "%p%\python.exe"
if errorlevel 1 goto :no-python
endlocal ^
& set "pt=%p%" ^
Expand All @@ -57,7 +57,7 @@ set "need_path_ext="
exit /b 0

:check-python
%~1 -V
%1 -V
:: 9009 means error file not found
if %errorlevel% equ 9009 (
echo Not an executable Python program
Expand Down

0 comments on commit 2faf997

Please sign in to comment.