Skip to content

Commit e044dfa

Browse files
committed
Issue python#28573: Avoid setting up env too many times during build
2 parents 63e6a7c + 4468bed commit e044dfa

2 files changed

Lines changed: 10 additions & 29 deletions

File tree

PCbuild/build.bat

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -120,9 +120,9 @@ if "%do_pgo%"=="true" (
120120
@echo off
121121
call :Kill
122122
set conf=PGUpdate
123+
set target=Build
123124
)
124125
goto Build
125-
126126
:Kill
127127
echo on
128128
msbuild "%dir%\pythoncore.vcxproj" /t:KillPython %verbose%^

Tools/msi/buildrelease.bat

Lines changed: 9 additions & 28 deletions
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,7 @@ set BUILDX86=
3535
set BUILDX64=
3636
set TARGET=Rebuild
3737
set TESTTARGETDIR=
38-
set PGO=default
38+
set PGO=-m test -q --pgo
3939
set BUILDNUGET=1
4040
set BUILDZIP=1
4141

@@ -109,14 +109,12 @@ exit /B 0
109109
@echo off
110110

111111
if "%1" EQU "x86" (
112-
call "%PCBUILD%env.bat" x86
113112
set PGO=
114113
set BUILD=%PCBUILD%win32\
115114
set BUILD_PLAT=Win32
116115
set OUTDIR_PLAT=win32
117116
set OBJDIR_PLAT=x86
118117
) else (
119-
call "%PCBUILD%env.bat" amd64
120118
set BUILD=%PCBUILD%amd64\
121119
set PGO=%~2
122120
set BUILD_PLAT=x64
@@ -149,29 +147,17 @@ if not "%SKIPBUILD%" EQU "1" (
149147
@echo off
150148

151149
if "%PGO%" EQU "" (
152-
@call "%PCBUILD%build.bat" -e -p %BUILD_PLAT% -t %TARGET% %CERTOPTS%
150+
set PGOOPTS=
153151
) else (
154-
@call "%PCBUILD%build.bat" -e -p %BUILD_PLAT% -c PGInstrument -t %TARGET% %CERTOPTS%
155-
@if errorlevel 1 exit /B
156-
157-
@del "%BUILD%*.pgc"
158-
if "%PGO%" EQU "default" (
159-
"%BUILD%python.exe" -m test -q --pgo
160-
) else if "%PGO%" EQU "default2" (
161-
"%BUILD%python.exe" -m test -r -q --pgo
162-
"%BUILD%python.exe" -m test -r -q --pgo
163-
) else if "%PGO%" EQU "default10" (
164-
for /L %%i in (0, 1, 9) do "%BUILD%python.exe" -m test -q -r --pgo
165-
) else (
166-
"%BUILD%python.exe" %PGO%
167-
)
168-
169-
@call "%PCBUILD%build.bat" -e -p %BUILD_PLAT% -c PGUpdate -t Build %CERTOPTS%
152+
set PGOOPTS=--pgo --pgojob "%PGO%"
170153
)
154+
@call "%PCBUILD%build.bat" -e -p %BUILD_PLAT% -t %TARGET% %CERTOPTS% %PGOOPTS%
171155
@if errorlevel 1 exit /B
156+
@rem build.bat turns echo back on, so we disable it again
172157
@echo off
173158
)
174159

160+
call "%PCBUILD%env.bat"
175161
if "%OUTDIR_PLAT%" EQU "win32" (
176162
msbuild "%D%launcher\launcher.wixproj" /p:Platform=x86 %CERTOPTS% /p:ReleaseUri=%RELEASE_URI%
177163
if errorlevel 1 exit /B
@@ -220,23 +206,18 @@ echo --build (-b) Incrementally build Python rather than rebuilding
220206
echo --skip-build (-B) Do not build Python (just do the installers)
221207
echo --skip-doc (-D) Do not build documentation
222208
echo --pgo Specify PGO command for x64 installers
223-
echo --skip-pgo Build x64 installers using PGO
209+
echo --skip-pgo Build x64 installers without using PGO
224210
echo --skip-nuget Do not build Nuget packages
225211
echo --skip-zip Do not build embeddable package
226-
echo --pgo Build x64 installers using PGO
227212
echo --download Specify the full download URL for MSIs
228213
echo --test Specify the test directory to run the installer tests
229214
echo -h Display this help information
230215
echo.
231216
echo If no architecture is specified, all architectures will be built.
232217
echo If --test is not specified, the installer tests are not run.
233218
echo.
234-
echo For the --pgo option, any Python command line can be used as well as the
235-
echo following shortcuts:
236-
echo Shortcut Description
237-
echo default Test suite with --pgo
238-
echo default2 2x test suite with --pgo and randomized test order
239-
echo default10 10x test suite with --pgo and randomized test order
219+
echo For the --pgo option, any Python command line can be used, or 'default' to
220+
echo use the default task (-m test --pgo).
240221
echo.
241222
echo The following substitutions will be applied to the download URL:
242223
echo Variable Description Example

0 commit comments

Comments
 (0)