From b21933faab008b01e010e453ff738f5e56befd9f Mon Sep 17 00:00:00 2001 From: Adam Joseph Date: Sat, 9 Apr 2022 18:35:50 -0700 Subject: [PATCH] cpython: have powerpc64le use "ppc64le" to follow PEP600 The PEP600 standard gives Python's naming scheme for various architectures; it follows the convention which was in use by Fedora in 2014. According to PEP600, the architecture name for Power PC is `ppc64le`, not `powerpc64le`. This is also how python3 declares its "supported wheels" under Debian on PowerPC, as checked with `pip debug --verbose` $ pip debug --verbose | grep powerpc $ pip debug --verbose | grep ppc | head cp39-cp39-manylinux_2_31_ppc64le cp39-cp39-manylinux_2_30_ppc64le cp39-cp39-manylinux_2_29_ppc64le cp39-cp39-manylinux_2_28_ppc64le cp39-cp39-manylinux_2_27_ppc64le cp39-cp39-manylinux_2_26_ppc64le cp39-cp39-manylinux_2_25_ppc64le cp39-cp39-manylinux_2_24_ppc64le cp39-cp39-manylinux_2_23_ppc64le Let's adjust the `pythonHostPlatform` expression in cpython/default.nix to pass the architecture using the naming scheme Python expects. Verified on a Raptor Computing Systems Talos II. Without this commit, PyQt5 fails to build, failing with "unsupported wheel". With this commit, it builds successfully. --- .../interpreters/python/cpython/default.nix | 14 +++++++++++++- 1 file changed, 13 insertions(+), 1 deletion(-) diff --git a/pkgs/development/interpreters/python/cpython/default.nix b/pkgs/development/interpreters/python/cpython/default.nix index 009d0f45f97e..a52935c69dfd 100644 --- a/pkgs/development/interpreters/python/cpython/default.nix +++ b/pkgs/development/interpreters/python/cpython/default.nix @@ -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 =