Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

Commit 16ef386

Browse filesBrowse files
bzozaddaleax
authored andcommitted
build, win: vcbuild improvements
Removes extra erroor messages when Python is not installed. Removes "vswhere not found" message when no VS2017 installation is found. Adds support for DEBUG_HELPER to vcbuild.bat. Fixes: #16864 PR-URL: #17015 Reviewed-By: Ben Noordhuis <info@bnoordhuis.nl> Reviewed-By: Gibson Fahnestock <gibfahn@gmail.com>
1 parent fc6ee39 commit 16ef386
Copy full SHA for 16ef386

File tree

Expand file treeCollapse file tree

3 files changed

+16
-9
lines changed
Open diff view settings
Filter options
Expand file treeCollapse file tree

3 files changed

+16
-9
lines changed
Open diff view settings
Collapse file

‎tools/msvs/find_python.cmd‎

Copy file name to clipboardExpand all lines: tools/msvs/find_python.cmd
+14-6Lines changed: 14 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
@IF NOT DEFINED DEBUG_HELPER @ECHO OFF
2+
echo Looking for Python 2.x
23
SETLOCAL
34
:: If python.exe is in %Path%, just validate
45
FOR /F "delims=" %%a IN ('where python 2^> NUL') DO (
@@ -14,18 +15,18 @@ FOR %%K IN ( "HKCU\Software", "HKLM\SOFTWARE", "HKLM\Software\Wow6432Node") DO (
1415
:: If validate returns 0 just jump to the end
1516
IF NOT ERRORLEVEL 1 GOTO :validate
1617
)
17-
EXIT /B 1
18+
goto :no-python
1819

1920
:: Helper subroutine to handle quotes in %1
2021
:find-main-branch
2122
SET main_key="%~1\Python\PythonCore"
22-
REG QUERY %main_key% /s | findstr "2." | findstr InstallPath > NUL 2> NUL
23+
REG QUERY %main_key% /s 2> NUL | findstr "2." | findstr InstallPath > NUL 2> NUL
2324
IF NOT ERRORLEVEL 1 CALL :find-key %main_key%
2425
EXIT /B
2526

2627
:: Query registry sub-tree for InstallPath
2728
:find-key
28-
FOR /F "delims=" %%a IN ('REG QUERY %1 /s ^| findstr "2." ^| findstr InstallPath') DO IF NOT ERRORLEVEL 1 CALL :find-path %%a
29+
FOR /F "delims=" %%a IN ('REG QUERY %1 /s 2> NUL ^| findstr "2." ^| findstr InstallPath') DO IF NOT ERRORLEVEL 1 CALL :find-path %%a
2930
EXIT /B
3031

3132
:: Parse the value of %1 as the path for python.exe
@@ -39,13 +40,20 @@ EXIT /B 1
3940

4041
:: Check if %p% holds a path to a real python2 executable
4142
:validate
42-
IF NOT EXIST "%p%python.exe" EXIT /B 1
43+
IF NOT EXIST "%p%python.exe" goto :no-python
4344
:: Check if %p% is python2
4445
"%p%python.exe" -V 2>&1 | findstr /R "^Python.2.*" > NUL
45-
IF ERRORLEVEL 1 EXIT /B %ERRORLEVEL%
46+
IF ERRORLEVEL 1 goto :no-python2
4647
:: We can wrap it up
4748
ENDLOCAL & SET pt=%p%& SET need_path_ext=%need_path%
4849
SET VCBUILD_PYTHON_LOCATION=%pt%python.exe
4950
IF %need_path_ext%==1 SET Path=%Path%;%pt%
5051
SET need_path_ext=
51-
EXIT /B %ERRORLEVEL%
52+
EXIT /B %ERRORLEVEL%
53+
54+
:no-python2
55+
echo Python found in %p%, but it is not v2.x.
56+
exit /B 1
57+
:no-python
58+
echo Could not find Python.
59+
exit /B 1
Collapse file

‎tools/msvs/vswhere_usability_wrapper.cmd‎

Copy file name to clipboardExpand all lines: tools/msvs/vswhere_usability_wrapper.cmd
-1Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -28,5 +28,4 @@ for /f "usebackq tokens=*" %%i in (`vswhere %VSWHERE_ARGS%`) do (
2828

2929
:no-vswhere
3030
endlocal
31-
echo could not find "vswhere"
3231
exit /B 1
Collapse file

‎vcbuild.bat‎

Copy file name to clipboardExpand all lines: vcbuild.bat
+2-2Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
@echo off
1+
@if not defined DEBUG_HELPER @ECHO OFF
22

33
cd %~dp0
44

@@ -170,7 +170,7 @@ if "%target%"=="Clean" rmdir /S /Q %~dp0deps\icu
170170
:no-depsicu
171171

172172
call tools\msvs\find_python.cmd
173-
if errorlevel 1 echo Could not find python2 & goto :exit
173+
if errorlevel 1 goto :exit
174174

175175
call :getnodeversion || exit /b 1
176176

0 commit comments

Comments
0 (0)
Morty Proxy This is a proxified and sanitized view of the page, visit original site.