Skip to content

Commit

Permalink
build,win: fix python detection script
Browse files Browse the repository at this point in the history
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]>
  • Loading branch information
jasongin authored and addaleax committed Aug 1, 2017
1 parent 9f50db2 commit 7b96944
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 3 deletions.
2 changes: 1 addition & 1 deletion tools/msvs/find_python.cmd
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ EXIT /B 1
:validate
IF NOT EXIST "%p%python.exe" EXIT /B 1
:: Check if %p% is python2
%p%python.exe -V 2>&1 | findstr /R "^Python.2.*" > NUL
"%p%python.exe" -V 2>&1 | findstr /R "^Python.2.*" > NUL
IF ERRORLEVEL 1 EXIT /B %ERRORLEVEL%
:: We can wrap it up
ENDLOCAL & SET pt=%p%& SET need_path_ext=%need_path%
Expand Down
4 changes: 2 additions & 2 deletions vcbuild.bat
Original file line number Diff line number Diff line change
Expand Up @@ -528,7 +528,7 @@ goto exit
:run-python
call tools\msvs\find_python.cmd
if errorlevel 1 echo Could not find python2 & goto :exit
set cmd1=%VCBUILD_PYTHON_LOCATION% %*
set cmd1="%VCBUILD_PYTHON_LOCATION%" %*
echo %cmd1%
%cmd1%
exit /b %ERRORLEVEL%
Expand All @@ -547,7 +547,7 @@ set TAG=
set FULLVERSION=
:: Call as subroutine for validation of python
call :run-python tools\getnodeversion.py > nul
for /F "tokens=*" %%i in ('%VCBUILD_PYTHON_LOCATION% tools\getnodeversion.py') do set NODE_VERSION=%%i
for /F "tokens=*" %%i in ('"%VCBUILD_PYTHON_LOCATION%" tools\getnodeversion.py') do set NODE_VERSION=%%i
if not defined NODE_VERSION (
echo Cannot determine current version of Node.js
exit /b 1
Expand Down

0 comments on commit 7b96944

Please sign in to comment.