summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMinijackson <minijackson@riseup.net>2022-12-20 13:58:06 +0100
committergithub-actions[bot] <github-actions[bot]@users.noreply.github.com>2023-01-19 14:21:08 +0000
commite652c1df1e583e79c0636423cacc6d4c7aa759ea (patch)
treed363617bb8ff3a8869549fcdf3a898761d27eb12
parentMerge pull request #211551 from NixOS/backport-211498-to-release-22.11 (diff)
downloadnixpkgs-origin/backport-210035-to-release-22.11.tar.gz
python: improve ABI name detectionorigin/backport-210035-to-release-22.11
(cherry picked from commit 859e05a74b70187be66d99f970b790eaab961f47)
-rw-r--r--pkgs/development/interpreters/python/cpython/default.nix21
1 files changed, 16 insertions, 5 deletions
diff --git a/pkgs/development/interpreters/python/cpython/default.nix b/pkgs/development/interpreters/python/cpython/default.nix
index 1f1c153c5b07..1a19bc463602 100644
--- a/pkgs/development/interpreters/python/cpython/default.nix
+++ b/pkgs/development/interpreters/python/cpython/default.nix
@@ -171,11 +171,22 @@ let
else if isx86_32 then "i386"
else parsed.cpu.name;
pythonAbiName =
- # python's build doesn't differentiate between musl and glibc in its
- # abi detection, our wrapper should match.
- if stdenv.hostPlatform.isMusl then
- replaceStrings [ "musl" ] [ "gnu" ] parsed.abi.name
- else parsed.abi.name;
+ # python's build doesn't support every gnu<extension>, and doesn't
+ # differentiate between musl and glibc, so we list those supported in
+ # here:
+ # 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 [
+ "gnux32"
+ "gnueabihf"
+ "gnueabi"
+ "gnuabin32"
+ "gnuabi64"
+ "gnuspe"
+ ]
+ then parsed.abi.name
+ else "gnu";
multiarch =
if isDarwin then "darwin"
else "${multiarchCpu}-${parsed.kernel.name}-${pythonAbiName}";