Package: python-cpuinfo
Version: 9.0.0+git20221119-2
Tags: ftbfs patch
Usertags: hppa
Severity: important

python-cpuinfo is missing code to detect hppa (parisc) CPUs.
The attached patch adds such basic info.

Can you please apply the patch soon, since dependend packages
fail to build from source without it, e.g. python-pyppmd, see:
https://buildd.debian.org/status/fetch.php?pkg=python-pyppmd&arch=hppa&ver=1.1.1%2Bds-1&stamp=1735496827&raw=0

example failure:
tests/test_benchmark.py:42:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
/usr/lib/python3/dist-packages/cpuinfo/__init__.py:2: in <module>
    from cpuinfo.cpuinfo import *
/usr/lib/python3/dist-packages/cpuinfo/cpuinfo.py:2839: in <module>
    _check_arch()
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _

    def _check_arch():
        arch, bits = _parse_arch(DataSource.arch_string_raw)
        if not arch in ['ARM_7', 'ARM_8',
                        'LOONG_32', 'LOONG_64',
                        'MIPS_32', 'MIPS_64',
                        'PPC_32', 'PPC_64',
                        'RISCV_32', 'RISCV_64',
                        'SPARC_32', 'SPARC_64',
                        'S390X',
                        'X86_32', 'X86_64']:
                raise Exception("py-cpuinfo currently only works on X86 "
                                "and some ARM/LoongArch/MIPS/PPC/RISCV/SPARC/S390X 
CPUs.")
E     Exception: py-cpuinfo currently only works on X86 and some 
ARM/LoongArch/MIPS/PPC/RISCV/SPARC/S390X CPUs.


Upstream seems to have some issues accepting new patches in general:
https://github.com/workhorsy/py-cpuinfo/issues/213

Helge
[PATCH] Add support for hppa / parisc CPUs

Allow to recognize the parisc cpus.
This fixes dependend packages from build failures, e.g.
python-pyppmd, see:
https://buildd.debian.org/status/fetch.php?pkg=python-pyppmd&arch=hppa&ver=1.1.1%2Bds-1&stamp=1736247366&raw=0

Signed-off-by: Helge Deller <del...@gmx.de>

diff -up ./cpuinfo/cpuinfo.py.org ./cpuinfo/cpuinfo.py
--- ./cpuinfo/cpuinfo.py.org	2025-01-07 13:36:31.820569455 +0000
+++ ./cpuinfo/cpuinfo.py	2025-01-07 14:05:18.818776037 +0000
@@ -360,6 +360,7 @@ def _read_windows_registry_key(key_name,
 def _check_arch():
 	arch, bits = _parse_arch(DataSource.arch_string_raw)
 	if not arch in ['ARM_7', 'ARM_8',
+	                'HPPA_32', 'HPPA_64',
 	                'LOONG_32', 'LOONG_64',
 	                'MIPS_32', 'MIPS_64',
 	                'PPC_32', 'PPC_64',
@@ -368,7 +369,7 @@ def _check_arch():
 	                'S390X',
 	                'X86_32', 'X86_64']:
 		raise Exception("py-cpuinfo currently only works on X86 "
-		                "and some ARM/LoongArch/MIPS/PPC/RISCV/SPARC/S390X CPUs.")
+				"and some ARM/HPPA/LoongArch/MIPS/PPC/RISCV/SPARC/S390X CPUs." )
 
 def _obj_to_b64(thing):
 	import pickle
@@ -841,6 +842,14 @@ def _parse_arch(arch_string_raw):
 	elif re.match(r'^loongarch64$', arch_string_raw):
 		arch = 'LOONG_64'
 		bits = 64
+	# HPPA
+	elif re.match(r'^parisc$|^parisc64$', arch_string_raw):
+		if platform.architecture()[0].startswith("32"):
+			arch = 'HPPA_32'
+			bits = 32
+		else:
+			arch = 'HPPA_64'
+			bits = 64
 
 	return (arch, bits)
 

Reply via email to