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
This commit is contained in:
Ben Wolsieffer 2023-08-09 01:16:58 -04:00 committed by GitHub
parent f54be2e5f9
commit 02719f21e6
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -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<extension>, 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"