mirror of
https://github.com/OrcaSlicer/OrcaSlicer.git
synced 2026-09-08 09:46:55 +00:00
fix: keep CRLF when patching CPython on Windows (#15346)
# Description Under `core.autocrlf=input`, a Windows dependency build fails while building CPython: ``` The system cannot find the batch label specified - begin_search Cannot locate python.exe on PATH or as PYTHON variable error MSB8066: ... exited with code 3 ``` `git apply` inherits the caller's git configuration, so it rewrites the patched `PCbuild/find_python.bat` to LF, and `cmd.exe` cannot resolve `goto` labels in an LF batch file. `git init` already runs in the extracted source, so setting `core.autocrlf` on that repository fixes it and leaves the shared `PATCH_CMD` alone. Only python3 is affected, its patch being the only one under `deps/` that touches a `.bat`. `core.autocrlf=true` (the Git for Windows default) and `false`/unset were never affected. If a dependency build later fails with `patch does not apply`, delete `deps/build` and rebuild. `git apply` is not idempotent, and that is independent of this change. ## Tests Visual Studio 2026 (18.6.3), `core.autocrlf=input`, built from an empty `deps/build-dbg`: | `deps debug` on | `find_python.bat` | CPython | |---|---|---| | `upstream/main` | 0 CRLF / 95 LF | fails at `begin_search` | | this branch | 94 CRLF / 1 LF | builds | It then stops at the debug staging step, a separate bug fixed by #15353; with both applied it installs `libpython`. I hit this on a debug build, but the patch step has no Debug/Release conditional. [How to Download Pull Requests Artifacts for Testing](https://www.orcaslicer.com/wiki/how_to_download_pr_artifacts)
This commit is contained in:
8
deps/python3/python3.cmake
vendored
8
deps/python3/python3.cmake
vendored
@@ -15,7 +15,13 @@ 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)
|
||||
#
|
||||
# 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_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)
|
||||
|
||||
Reference in New Issue
Block a user