Skip to content

Commit 325813e

Browse files
jasonginMylesBorins
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". Backport-PR-URL: #14842 PR-URL: #14546 Reviewed-By: Timothy Gu <timothygu99@gmail.com> Reviewed-By: Refael Ackermann <refack@gmail.com> Reviewed-By: Colin Ihrig <cjihrig@gmail.com> Reviewed-By: James M Snell <jasnell@gmail.com> Reviewed-By: Anna Henningsen <anna@addaleax.net>
1 parent c2090a0 commit 325813e

2 files changed

Lines changed: 3 additions & 3 deletions

File tree

‎tools/msvs/find_python.cmd‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,7 @@ EXIT /B 1
4141
:validate
4242
IFNOTEXIST"%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
IFERRORLEVEL1EXIT /B %ERRORLEVEL%
4646
:: We can wrap it up
4747
ENDLOCAL&SETpt=%p%&SETneed_path_ext=%need_path%

‎vcbuild.bat‎

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -378,7 +378,7 @@ goto exit
378378
:run-python
379379
call tools\msvs\find_python.cmd
380380
iferrorlevel1echo Could not find python2 &goto :exit
381-
setcmd1=%VCBUILD_PYTHON_LOCATION%%*
381+
setcmd1="%VCBUILD_PYTHON_LOCATION%"%*
382382
echo%cmd1%
383383
%cmd1%
384384
exit /b %ERRORLEVEL%
@@ -396,7 +396,7 @@ set TAG=
396396
setFULLVERSION=
397397
:: Call as subroutine for validation of python
398398
call :run-python tools\getnodeversion.py >nul
399-
for /F "tokens=*"%%iin ('%VCBUILD_PYTHON_LOCATION% tools\getnodeversion.py') dosetNODE_VERSION=%%i
399+
for /F "tokens=*"%%iin ('"%VCBUILD_PYTHON_LOCATION%" tools\getnodeversion.py') dosetNODE_VERSION=%%i
400400
ifnotdefined NODE_VERSION (
401401
echo Cannot determine current version of Node.js
402402
exit /b 1

0 commit comments

Comments
 (0)