From 575a8748325396c2018360a0216e1a70d55c2e0c Mon Sep 17 00:00:00 2001 From: raistlin7447 Date: Sun, 23 Aug 2026 19:37:35 -0500 Subject: [PATCH 1/2] fix: keep CRLF when patching CPython on Windows git apply inherits the caller's configuration, so under core.autocrlf=input it rewrites the patched PCbuild/find_python.bat to LF. cmd.exe cannot resolve goto labels in an LF batch file, so CPython's build fails with "The system cannot find the batch label specified - begin_search" and then "Cannot locate python.exe on PATH or as PYTHON variable". git init already runs in the extracted source, so setting core.autocrlf on the repository it creates is enough, without touching the shared PATCH_CMD. --- deps/python3/python3.cmake | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/deps/python3/python3.cmake b/deps/python3/python3.cmake index e93045fe45..936d75f488 100644 --- a/deps/python3/python3.cmake +++ b/deps/python3/python3.cmake @@ -15,7 +15,12 @@ if(WIN32) # See https://github.com/python/cpython/issues/153438 # Patch from https://github.com/python/cpython/pull/153608 # This patch has not been merged to 3.12 yet so we need to apply it manually - set(_patch_cmd git init && ${PATCH_CMD} ${CMAKE_CURRENT_LIST_DIR}/01-windows-nuget.patch) + # + # The config lands on the CPython repo git init just made, not OrcaSlicer. Without + # it the patched find_python.bat comes out LF and cmd.exe cannot find its goto labels. + set(_patch_cmd git init + && git config core.autocrlf false + && ${PATCH_CMD} ${CMAKE_CURRENT_LIST_DIR}/01-windows-nuget.patch) if(MSVC_VERSION EQUAL 1800) set(_python_platform_toolset v120) From 4d67159ea2463dc662e00555b0203b9210c9e6bb Mon Sep 17 00:00:00 2001 From: raistlin7447 Date: Mon, 31 Aug 2026 08:20:26 -0500 Subject: [PATCH 2/2] fix: scope the CRLF override to the git apply invocation git config wrote core.autocrlf into the repository git init creates in the extracted CPython source. Nothing outside deps/build reads that repository, so the setting was already contained. -c applies the override to the one invocation instead, so no repository config is written at all. It cannot reuse PATCH_CMD, so the shared flags are spelled out here. --- deps/python3/python3.cmake | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/deps/python3/python3.cmake b/deps/python3/python3.cmake index 936d75f488..78eb6e72b2 100644 --- a/deps/python3/python3.cmake +++ b/deps/python3/python3.cmake @@ -16,11 +16,12 @@ if(WIN32) # Patch from https://github.com/python/cpython/pull/153608 # This patch has not been merged to 3.12 yet so we need to apply it manually # - # The config lands on the CPython repo git init just made, not OrcaSlicer. Without - # it the patched find_python.bat comes out LF and cmd.exe cannot find its goto labels. + # Without core.autocrlf=false the patched find_python.bat comes out LF and + # cmd.exe cannot find its goto labels. set(_patch_cmd git init - && git config core.autocrlf false - && ${PATCH_CMD} ${CMAKE_CURRENT_LIST_DIR}/01-windows-nuget.patch) + && ${GIT_EXECUTABLE} -c core.autocrlf=false apply --verbose + --ignore-space-change --whitespace=fix + ${CMAKE_CURRENT_LIST_DIR}/01-windows-nuget.patch) if(MSVC_VERSION EQUAL 1800) set(_python_platform_toolset v120)