Skip to content

Commit 2c7de9d

Browse files
seishunMylesBorins
authored andcommitted
build,win: replace run-python subroutine with single find_python call
A subroutine does not work as a replacement for the `python` command since one cannot use a subroutine call in a `for /F` loop. PR-URL: #18621 Reviewed-By: Bartosz Sosnowski <[email protected]> Reviewed-By: Benjamin Gruenbaum <[email protected]> Reviewed-By: Richard Lau <[email protected]>
1 parent 9bec493 commit 2c7de9d

File tree

1 file changed

+12
-16
lines changed

1 file changed

+12
-16
lines changed

vcbuild.bat

+12-16
Original file line numberDiff line numberDiff line change
@@ -169,6 +169,9 @@ if "%target%"=="Clean" echo deleting %~dp0deps\icu
169169
if "%target%"=="Clean" rmdir /S /Q %~dp0deps\icu
170170
:no-depsicu
171171

172+
call tools\msvs\find_python.cmd
173+
if errorlevel 1 echo Could not find python2 & goto :exit
174+
172175
call :getnodeversion || exit /b 1
173176

174177
if defined TAG set configure_flags=%configure_flags% --tag=%TAG%
@@ -265,7 +268,8 @@ goto run
265268
if defined noprojgen goto msbuild
266269

267270
@rem Generate the VS project.
268-
call :run-python configure %configure_flags%
271+
echo configure %configure_flags%
272+
python configure %configure_flags%
269273
if errorlevel 1 goto create-msvs-files-failed
270274
if not exist node.sln goto create-msvs-files-failed
271275
echo Project files generated.
@@ -457,7 +461,7 @@ if defined test_node_inspect goto node-test-inspect
457461
goto node-tests
458462

459463
:node-check-deopts
460-
call :run-python tools\test.py --mode=release --check-deopts parallel sequential -J
464+
python tools\test.py --mode=release --check-deopts parallel sequential -J
461465
if defined test_node_inspect goto node-test-inspect
462466
goto node-tests
463467

@@ -481,7 +485,8 @@ if defined no_cctest echo Skipping cctest because no-cctest was specified && got
481485
echo running 'cctest %cctest_args%'
482486
"%config%\cctest" %cctest_args%
483487
:run-test-py
484-
call :run-python tools\test.py %test_args%
488+
echo running 'python tools\test.py %test_args%'
489+
python tools\test.py %test_args%
485490
goto test-v8
486491

487492
:test-v8
@@ -493,7 +498,7 @@ goto lint-cpp
493498
:lint-cpp
494499
if not defined lint_cpp goto lint-js
495500
call :run-lint-cpp src\*.c src\*.cc src\*.h test\addons\*.cc test\addons\*.h test\addons-napi\*.cc test\addons-napi\*.h test\cctest\*.cc test\cctest\*.h test\gc\binding.cc tools\icu\*.cc tools\icu\*.h
496-
call :run-python tools/check-imports.py
501+
python tools/check-imports.py
497502
goto lint-js
498503

499504
:run-lint-cpp
@@ -509,7 +514,7 @@ for /f "tokens=*" %%G in ('dir /b /s /a %*') do (
509514
( endlocal
510515
set cppfilelist=%localcppfilelist%
511516
)
512-
call :run-python tools/cpplint.py %cppfilelist% > nul
517+
python tools/cpplint.py %cppfilelist% > nul
513518
goto exit
514519

515520
:add-to-list
@@ -571,14 +576,6 @@ echo vcbuild.bat lint : runs the C++ and JavaScript linter
571576
echo vcbuild.bat no-cctest : skip building cctest.exe
572577
goto exit
573578

574-
:run-python
575-
call tools\msvs\find_python.cmd
576-
if errorlevel 1 echo Could not find python2 & goto :exit
577-
set cmd1="%VCBUILD_PYTHON_LOCATION%" %*
578-
echo %cmd1%
579-
%cmd1%
580-
exit /b %ERRORLEVEL%
581-
582579
:exit
583580
goto :EOF
584581

@@ -591,9 +588,8 @@ rem ***************
591588
set NODE_VERSION=
592589
set TAG=
593590
set FULLVERSION=
594-
:: Call as subroutine for validation of python
595-
call :run-python tools\getnodeversion.py > nul
596-
for /F "tokens=*" %%i in ('"%VCBUILD_PYTHON_LOCATION%" tools\getnodeversion.py') do set NODE_VERSION=%%i
591+
592+
for /F "usebackq tokens=*" %%i in (`python "%~dp0tools\getnodeversion.py"`) do set NODE_VERSION=%%i
597593
if not defined NODE_VERSION (
598594
echo Cannot determine current version of Node.js
599595
exit /b 1

0 commit comments

Comments
 (0)