From 02719f21e6b1e9116739299045532ecf023ead5e Mon Sep 17 00:00:00 2001 From: Ben Wolsieffer Date: Wed, 9 Aug 2023 01:16:58 -0400 Subject: [PATCH] cpython: fix _PYTHON_SYSCONFIGDATA_NAME on armv7l with musl (#240770) Python always uses "gnu" prefixed ABI names, and this patch handles this by doing a musl->gnu string replacement. With pkgsCross.armv7l-hf-multiplatform.pkgsStatic, the previous name was: _sysconfigdata__linux_arm-linux-gnu Now, the corrected name is: _sysconfigdata__linux_arm-linux-gnueabihf --- pkgs/development/interpreters/python/cpython/default.nix | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/pkgs/development/interpreters/python/cpython/default.nix b/pkgs/development/interpreters/python/cpython/default.nix index dc9b57304d6b..a491c6c1d619 100644 --- a/pkgs/development/interpreters/python/cpython/default.nix +++ b/pkgs/development/interpreters/python/cpython/default.nix @@ -184,6 +184,8 @@ let if parsed.cpu.significantByte.name == "littleEndian" then "arm" else "armeb" else if isx86_32 then "i386" else parsed.cpu.name; + # Python doesn't distinguish musl and glibc and always prefixes with "gnu" + gnuAbiName = replaceStrings [ "musl" ] [ "gnu" ] parsed.abi.name; pythonAbiName = # python's build doesn't support every gnu, and doesn't # differentiate between musl and glibc, so we list those supported in @@ -191,7 +193,7 @@ let # https://github.com/python/cpython/blob/e488e300f5c01289c10906c2e53a8e43d6de32d8/configure.ac#L724 # Note: this is an approximation, as it doesn't take into account the CPU # family, or the nixpkgs abi naming conventions. - if elem parsed.abi.name [ + if elem gnuAbiName [ "gnux32" "gnueabihf" "gnueabi" @@ -199,7 +201,7 @@ let "gnuabi64" "gnuspe" ] - then parsed.abi.name + then gnuAbiName else "gnu"; multiarch = if isDarwin then "darwin"