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

PR-URL: #42810
Reviewed-By: Rich Trott <[email protected]>
Reviewed-By: James M Snell <[email protected]>
  • Loading branch information
lpinca authored Apr 23, 2022
1 parent 603803e commit e2ff1c3
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 e2ff1c3

Please sign in to comment.