]> git.ipfire.org Git - thirdparty/Python/cpython.git/commitdiff
gh-145110: Fix cleaning of PGO builds in Windows build.bat script (GH-145111)
authorChris Eibl <138194463+chris-eibl@users.noreply.github.com>
Mon, 23 Feb 2026 22:53:56 +0000 (23:53 +0100)
committerGitHub <noreply@github.com>
Mon, 23 Feb 2026 22:53:56 +0000 (22:53 +0000)
Misc/NEWS.d/next/Build/2026-02-22-13-35-20.gh-issue-145110.KgWofW.rst [new file with mode: 0644]
PCbuild/build.bat

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 (file)
index 0000000..035d0c1
--- /dev/null
@@ -0,0 +1,2 @@
+Fix targets "Clean" and "CLeanAll" in case of PGO builds on Windows. Patch by
+Chris Eibl.
index 8c24309be262baa22fe558dc7d539abc828ef51a..8fb2f096c93c0e4ae2cb0e5ea90d3c14830468e1 100644 (file)
@@ -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