bpo-30687: Fixes build scripts to find msbuild.exe and stop relying o… · python/cpython@40a23e8 (original) (raw)
`@@ -53,7 +53,6 @@ exit /b 127
`
53
53
`:Run
`
54
54
`setlocal
`
55
55
`set platf=Win32
`
56
``
`-
set vs_platf=x86
`
57
56
`set conf=Release
`
58
57
`set target=Build
`
59
58
`set dir=%~dp0
`
`@@ -62,10 +61,6 @@ set verbose=/nologo /v:m
`
62
61
`set kill=
`
63
62
`set do_pgo=
`
64
63
`set pgo_job=-m test --pgo
`
65
``
`-
set on_64_bit=true
`
66
``
-
67
``
`-
rem This may not be 100% accurate, but close enough.
`
68
``
`-
if "%ProgramFiles(x86)%"=="" (set on_64_bit=false)
`
69
64
``
70
65
`:CheckOpts
`
71
66
`if "%~1"=="-h" goto Usage
`
`@@ -95,18 +90,12 @@ if "%IncludeTkinter%"=="" set IncludeTkinter=true
`
95
90
``
96
91
`if "%IncludeExternals%"=="true" call "%dir%get_externals.bat"
`
97
92
``
98
``
`-
if "%platf%"=="x64" (
`
99
``
`-
if "%on_64_bit%"=="true" (
`
100
``
`-
rem This ought to always be correct these days...
`
101
``
`-
set vs_platf=amd64
`
102
``
`-
) else (
`
103
``
`-
if "%do_pgo%"=="true" (
`
104
``
`-
echo.ERROR: Cannot cross-compile with PGO
`
105
``
`-
echo. 32bit operating system detected, if this is incorrect,
`
106
``
`-
echo. make sure the ProgramFiles(x86^) environment variable is set
`
107
``
`-
exit /b 1
`
108
``
`-
)
`
109
``
`-
set vs_platf=x86_amd64
`
``
93
`+
if "%do_pgo%" EQU "true" if "%platf%" EQU "x64" (
`
``
94
`+
if "%PROCESSOR_ARCHITEW6432%" NEQ "AMD64" if "%PROCESSOR_ARCHITECTURE%" NEQ "AMD64" (
`
``
95
`+
echo.ERROR: Cannot cross-compile with PGO
`
``
96
`+
echo. 32bit operating system detected. Ensure your PROCESSOR_ARCHITECTURE
`
``
97
`+
echo. and PROCESSOR_ARCHITEW6432 environment variables are correct.
`
``
98
`+
exit /b 1
`
110
99
` )
`
111
100
`)
`
112
101
``
`@@ -115,7 +104,8 @@ if exist "%GIT%" set GITProperty=/p:GIT="%GIT%"
`
115
104
`if not exist "%GIT%" echo Cannot find Git on PATH & set GITProperty=
`
116
105
``
117
106
`rem Setup the environment
`
118
``
`-
call "%dir%env.bat" %vs_platf% >nul
`
``
107
`+
call "%dir%find_msbuild.bat" %MSBUILD%
`
``
108
`+
if ERRORLEVEL 1 (echo Cannot locate MSBuild.exe on PATH or as MSBUILD variable & exit /b 2)
`
119
109
``
120
110
`if "%kill%"=="true" call :Kill
`
121
111
``
`@@ -134,7 +124,7 @@ if "%do_pgo%"=="true" (
`
134
124
`goto Build
`
135
125
`:Kill
`
136
126
`echo on
`
137
``
`-
msbuild "%dir%\pythoncore.vcxproj" /t:KillPython %verbose%^
`
``
127
`+
%MSBUILD% "%dir%\pythoncore.vcxproj" /t:KillPython %verbose%^
`
138
128
` /p:Configuration=%conf% /p:Platform=%platf%^
`
139
129
` /p:KillPython=true
`
140
130
``
`@@ -146,7 +136,7 @@ rem Call on MSBuild to do the work, echo the command.
`
146
136
`rem Passing %1-9 is not the preferred option, but argument parsing in
`
147
137
`rem batch is, shall we say, "lackluster"
`
148
138
`echo on
`
149
``
`-
msbuild "%dir%pcbuild.proj" /t:%target% %parallel% %verbose%^
`
``
139
`+
%MSBUILD% "%dir%pcbuild.proj" /t:%target% %parallel% %verbose%^
`
150
140
` /p:Configuration=%conf% /p:Platform=%platf%^
`
151
141
` /p:IncludeExternals=%IncludeExternals%^
`
152
142
` /p:IncludeSSL=%IncludeSSL% /p:IncludeTkinter=%IncludeTkinter%^
`
`@@ -158,4 +148,4 @@ goto :eof
`
158
148
``
159
149
`:Version
`
160
150
`rem Display the current build version information
`
161
``
`-
msbuild "%dir%python.props" /t:ShowVersionInfo /v:m /nologo %1 %2 %3 %4 %5 %6 %7 %8 %9
`
``
151
`+
%MSBUILD% "%dir%python.props" /t:ShowVersionInfo /v:m /nologo %1 %2 %3 %4 %5 %6 %7 %8 %9
`