Clone of https://github.com/NixOS/nixpkgs.git (to stress-test knotserver)

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.

authored by Adam Joseph and committed by Frederik Rietdijk b21933fa d83c9aaf

Changed files
+13 -1
pkgs
development
interpreters
python
cpython
+13 -1
pkgs/development/interpreters/python/cpython/default.nix
··· 144 144 # The configure script uses "arm" as the CPU name for all 32-bit ARM 145 145 # variants when cross-compiling, but native builds include the version 146 146 # suffix, so we do the same. 147 - pythonHostPlatform = "${parsed.kernel.name}-${parsed.cpu.name}"; 147 + pythonHostPlatform = let 148 + cpu = { 149 + # According to PEP600, Python's name for the Power PC 150 + # architecture is "ppc", not "powerpc". Without the Rosetta 151 + # Stone below, the PEP600 requirement that "${ARCH} matches 152 + # the return value from distutils.util.get_platform()" fails. 153 + # https://peps.python.org/pep-0600/ 154 + powerpc = "ppc"; 155 + powerpcle = "ppcle"; 156 + powerpc64 = "ppc64"; 157 + powerpc64le = "ppc64le"; 158 + }.${parsed.cpu.name} or parsed.cpu.name; 159 + in "${parsed.kernel.name}-${cpu}"; 148 160 149 161 # https://github.com/python/cpython/blob/e488e300f5c01289c10906c2e53a8e43d6de32d8/configure.ac#L724 150 162 multiarchCpu =