Skip to content

Commit 2b43490

Browse files
minijacksonFRidh
authored andcommittedJan 19, 2023
python: improve ABI name detection
1 parent 29aecf0 commit 2b43490

File tree

1 file changed

+16
-5
lines changed
  • pkgs/development/interpreters/python/cpython

1 file changed

+16
-5
lines changed
 

‎pkgs/development/interpreters/python/cpython/default.nix

+16-5
Original file line numberDiff line numberDiff line change
@@ -171,11 +171,22 @@ let
171171
else if isx86_32 then "i386"
172172
else parsed.cpu.name;
173173
pythonAbiName =
174-
# python's build doesn't differentiate between musl and glibc in its
175-
# abi detection, our wrapper should match.
176-
if stdenv.hostPlatform.isMusl then
177-
replaceStrings [ "musl" ] [ "gnu" ] parsed.abi.name
178-
else parsed.abi.name;
174+
# python's build doesn't support every gnu<extension>, and doesn't
175+
# differentiate between musl and glibc, so we list those supported in
176+
# here:
177+
# https://github.com/python/cpython/blob/e488e300f5c01289c10906c2e53a8e43d6de32d8/configure.ac#L724
178+
# Note: this is an approximation, as it doesn't take into account the CPU
179+
# family, or the nixpkgs abi naming conventions.
180+
if elem parsed.abi.name [
181+
"gnux32"
182+
"gnueabihf"
183+
"gnueabi"
184+
"gnuabin32"
185+
"gnuabi64"
186+
"gnuspe"
187+
]
188+
then parsed.abi.name
189+
else "gnu";
179190
multiarch =
180191
if isDarwin then "darwin"
181192
else "${multiarchCpu}-${parsed.kernel.name}-${pythonAbiName}";

0 commit comments

Comments
 (0)