From 708a493c1397937ac2c8dc1e18b655b455d69f70 Mon Sep 17 00:00:00 2001 From: Greg Hellings Date: Thu, 24 Oct 2024 14:56:38 -0500 Subject: [PATCH] python3: proper syntax for Windows patches Windows patches were being added with a shell glob, which was dying with an error. See #351007. Use filesystem methods to walk the patch set and retrieve the patch names. Also, update the patches from the Fedora project to the latest for Python 3.11.9 and add filtering for any that are already applied to the 3.11.10 in the current cycle. python312 still fails to cross-compile after this patch, but at least 3.11 will again be available --- .../interpreters/python/cpython/default.nix | 26 +++++++++++++++---- 1 file changed, 21 insertions(+), 5 deletions(-) diff --git a/pkgs/development/interpreters/python/cpython/default.nix b/pkgs/development/interpreters/python/cpython/default.nix index 37764506e296..392aa5afb145 100644 --- a/pkgs/development/interpreters/python/cpython/default.nix +++ b/pkgs/development/interpreters/python/cpython/default.nix @@ -310,12 +310,28 @@ in with passthru; stdenv.mkDerivation (finalAttrs: { mingw-patch = fetchgit { name = "mingw-python-patches"; url = "https://src.fedoraproject.org/rpms/mingw-python3.git"; - rev = "45c45833ab9e5480ad0ae00778a05ebf35812ed4"; # for python 3.11.5 at the time of writing. - sha256 = "sha256-KIyNvO6MlYTrmSy9V/DbzXm5OsIuyT/BEpuo7Umm9DI="; + rev = "3edecdbfb4bbf1276d09cd5e80e9fb3dd88c9511"; # for python 3.11.9 at the time of writing. + hash = "sha256-kpXoIHlz53+0FAm/fK99ZBdNUg0u13erOr1XP2FSkQY="; }; - in [ - "${mingw-patch}/*.patch" - ]); + in ( + builtins.map (f: "${mingw-patch}/${f}") + [ + # The other patches in that repo are already applied to 3.11.10 + "mingw-python3_distutils.patch" + "mingw-python3_frozenmain.patch" + "mingw-python3_make-sysconfigdata.py-relocatable.patch" + "mingw-python3_mods-failed.patch" + "mingw-python3_module-select.patch" + "mingw-python3_module-socket.patch" + "mingw-python3_modules.patch" + "mingw-python3_platform-mingw.patch" + "mingw-python3_posix-layout.patch" + "mingw-python3_pthread_threadid.patch" + "mingw-python3_pythonw.patch" + "mingw-python3_setenv.patch" + "mingw-python3_win-modules.patch" + ]) + ); postPatch = optionalString (!stdenv.hostPlatform.isWindows) '' substituteInPlace Lib/subprocess.py \