From: Chris Eibl <138194463+chris-eibl@users.noreply.github.com> Date: Mon, 23 Feb 2026 22:53:56 +0000 (+0100) Subject: gh-145110: Fix cleaning of PGO builds in Windows build.bat script (GH-145111) X-Git-Tag: v3.15.0a7~169 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=0e4b1ba55dee1da7bc19d370e784483cd64b12e7;p=thirdparty%2FPython%2Fcpython.git gh-145110: Fix cleaning of PGO builds in Windows build.bat script (GH-145111) --- diff --git a/Misc/NEWS.d/next/Build/2026-02-22-13-35-20.gh-issue-145110.KgWofW.rst b/Misc/NEWS.d/next/Build/2026-02-22-13-35-20.gh-issue-145110.KgWofW.rst new file mode 100644 index 000000000000..035d0c141d36 --- /dev/null +++ b/Misc/NEWS.d/next/Build/2026-02-22-13-35-20.gh-issue-145110.KgWofW.rst @@ -0,0 +1,2 @@ +Fix targets "Clean" and "CLeanAll" in case of PGO builds on Windows. Patch by +Chris Eibl. diff --git a/PCbuild/build.bat b/PCbuild/build.bat index 8c24309be262..8fb2f096c93c 100644 --- a/PCbuild/build.bat +++ b/PCbuild/build.bat @@ -66,6 +66,7 @@ setlocal set platf=x64 set conf=Release set target=Build +set clean=false set dir=%~dp0 set parallel=/m set verbose=/nologo /v:m /clp:summary @@ -119,6 +120,9 @@ if "%UseJIT%" NEQ "true" set IncludeLLVM=false if "%IncludeExternals%"=="true" call "%dir%get_externals.bat" +if /I "%target%"=="Clean" set clean=true +if /I "%target%"=="CleanAll" set clean=true + if "%do_pgo%" EQU "true" if "%platf%" EQU "x64" ( if "%PROCESSOR_ARCHITEW6432%" NEQ "AMD64" if "%PROCESSOR_ARCHITECTURE%" NEQ "AMD64" ( echo.ERROR: Cannot cross-compile with PGO @@ -159,15 +163,20 @@ if "%do_pgo%"=="true" ( rem %VARS% are evaluated eagerly, which would lose the ERRORLEVEL rem value if we didn't split it out here. if "%do_pgo%"=="true" if ERRORLEVEL 1 exit /B %ERRORLEVEL% + +rem In case of a PGO build, we switch the conf here to PGUpdate +rem to get it cleaned or built as well. if "%do_pgo%"=="true" ( del /s "%dir%\*.pgc" del /s "%dir%\..\Lib\*.pyc" - echo on - call "%dir%\..\python.bat" %pgo_job% - @echo off - call :Kill set conf=PGUpdate - set target=Build + if "%clean%"=="false" ( + echo on + call "%dir%\..\python.bat" %pgo_job% + @echo off + call :Kill + set target=Build + ) ) goto :Build