about summary refs log tree commit diff
path: root/pkgs/development/interpreters/python/cpython/default.nix
diff options
context:
space:
mode:
Diffstat (limited to 'pkgs/development/interpreters/python/cpython/default.nix')
-rw-r--r--pkgs/development/interpreters/python/cpython/default.nix20
1 files changed, 17 insertions, 3 deletions
diff --git a/pkgs/development/interpreters/python/cpython/default.nix b/pkgs/development/interpreters/python/cpython/default.nix
index 1218f2eb24e04..a52935c69dfda 100644
--- a/pkgs/development/interpreters/python/cpython/default.nix
+++ b/pkgs/development/interpreters/python/cpython/default.nix
@@ -82,7 +82,7 @@ let
 
   passthru = let
     # When we override the interpreter we also need to override the spliced versions of the interpreter
-    inputs' = lib.filterAttrs (_: v: ! lib.isDerivation v) inputs;
+    inputs' = lib.filterAttrs (n: v: ! lib.isDerivation v && n != "passthruFun") inputs;
     override = attr: let python = attr.override (inputs' // { self = python; }); in python;
   in passthruFun rec {
     inherit self sourceVersion packageOverrides;
@@ -144,7 +144,19 @@ let
     # The configure script uses "arm" as the CPU name for all 32-bit ARM
     # variants when cross-compiling, but native builds include the version
     # suffix, so we do the same.
-    pythonHostPlatform = "${parsed.kernel.name}-${parsed.cpu.name}";
+    pythonHostPlatform = let
+      cpu = {
+        # According to PEP600, Python's name for the Power PC
+        # architecture is "ppc", not "powerpc".  Without the Rosetta
+        # Stone below, the PEP600 requirement that "${ARCH} matches
+        # the return value from distutils.util.get_platform()" fails.
+        # https://peps.python.org/pep-0600/
+        powerpc = "ppc";
+        powerpcle = "ppcle";
+        powerpc64 = "ppc64";
+        powerpc64le = "ppc64le";
+      }.${parsed.cpu.name} or parsed.cpu.name;
+    in "${parsed.kernel.name}-${cpu}";
 
     # https://github.com/python/cpython/blob/e488e300f5c01289c10906c2e53a8e43d6de32d8/configure.ac#L724
     multiarchCpu =
@@ -225,9 +237,11 @@ in with passthru; stdenv.mkDerivation {
     # * https://bugs.python.org/issue35523
     # * https://github.com/python/cpython/commit/e6b247c8e524
     ./3.7/no-win64-workaround.patch
-  ] ++ optionals (pythonAtLeast "3.7") [
+  ] ++ optionals (pythonAtLeast "3.7" && pythonOlder "3.11") [
     # Fix darwin build https://bugs.python.org/issue34027
     ./3.7/darwin-libutil.patch
+  ] ++ optionals (pythonAtLeast "3.11") [
+    ./3.11/darwin-libutil.patch
   ] ++ optionals (pythonOlder "3.8") [
     # Backport from CPython 3.8 of a good list of tests to run for PGO.
     (