Skip to content

Commit 7b96944

Browse files
jasonginaddaleax
authored andcommitted
build,win: fix python detection script
Handle spaces in the path to python.exe, in case it is installed under some directory like "C:\Program Files". PR-URL: #14546 Reviewed-By: Timothy Gu <[email protected]> Reviewed-By: Refael Ackermann <[email protected]> Reviewed-By: Colin Ihrig <[email protected]> Reviewed-By: James M Snell <[email protected]> Reviewed-By: Anna Henningsen <[email protected]>
1 parent 9f50db2 commit 7b96944

File tree

2 files changed

+3
-3
lines changed

2 files changed

+3
-3
lines changed

tools/msvs/find_python.cmd

+1-1
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,7 @@ EXIT /B 1
4141
:validate
4242
IF NOT EXIST "%p%python.exe" EXIT /B 1
4343
:: Check if %p% is python2
44-
%p%python.exe -V 2>&1 | findstr /R "^Python.2.*" > NUL
44+
"%p%python.exe" -V 2>&1 | findstr /R "^Python.2.*" > NUL
4545
IF ERRORLEVEL 1 EXIT /B %ERRORLEVEL%
4646
:: We can wrap it up
4747
ENDLOCAL & SET pt=%p%& SET need_path_ext=%need_path%

vcbuild.bat

+2-2
Original file line numberDiff line numberDiff line change
@@ -528,7 +528,7 @@ goto exit
528528
:run-python
529529
call tools\msvs\find_python.cmd
530530
if errorlevel 1 echo Could not find python2 & goto :exit
531-
set cmd1=%VCBUILD_PYTHON_LOCATION% %*
531+
set cmd1="%VCBUILD_PYTHON_LOCATION%" %*
532532
echo %cmd1%
533533
%cmd1%
534534
exit /b %ERRORLEVEL%
@@ -547,7 +547,7 @@ set TAG=
547547
set FULLVERSION=
548548
:: Call as subroutine for validation of python
549549
call :run-python tools\getnodeversion.py > nul
550-
for /F "tokens=*" %%i in ('%VCBUILD_PYTHON_LOCATION% tools\getnodeversion.py') do set NODE_VERSION=%%i
550+
for /F "tokens=*" %%i in ('"%VCBUILD_PYTHON_LOCATION%" tools\getnodeversion.py') do set NODE_VERSION=%%i
551551
if not defined NODE_VERSION (
552552
echo Cannot determine current version of Node.js
553553
exit /b 1

0 commit comments

Comments
 (0)