diff --git a/0001-pycpuinfo-9.0.0-add-loongarch-support.patch b/0001-pycpuinfo-9.0.0-add-loongarch-support.patch new file mode 100644 index 0000000000000000000000000000000000000000..584d93ba6a731ed3b8ab8d3d96f42601c6eb2950 --- /dev/null +++ b/0001-pycpuinfo-9.0.0-add-loongarch-support.patch @@ -0,0 +1,53 @@ +From e167c73cf7fc6b93e72a8de1f2c31805587e31bb Mon Sep 17 00:00:00 2001 +From: Huang Yang +Date: Thu, 9 May 2024 12:28:55 +0000 +Subject: [PATCH] init + +--- + cpuinfo/cpuinfo.py | 11 +++++++++-- + tests/test_invalid_cpu.py | 2 +- + 2 files changed, 10 insertions(+), 3 deletions(-) + +diff --git a/cpuinfo/cpuinfo.py b/cpuinfo/cpuinfo.py +index ea2f90e..a8ebefd 100644 +--- a/cpuinfo/cpuinfo.py ++++ b/cpuinfo/cpuinfo.py +@@ -362,9 +362,9 @@ def _check_arch(): + arch, bits = _parse_arch(DataSource.arch_string_raw) + if not arch in ['X86_32', 'X86_64', 'ARM_7', 'ARM_8', + 'PPC_64', 'S390X', 'MIPS_32', 'MIPS_64', +- "RISCV_32", "RISCV_64"]: ++ "RISCV_32", "RISCV_64","LOONGARCH_32","LOONGARCH_64"]: + raise Exception("py-cpuinfo currently only works on X86 " +- "and some ARM/PPC/S390X/MIPS/RISCV CPUs.") ++ "and some ARM/PPC/S390X/MIPS/RISCV/LOONGARCH CPUs.") + + def _obj_to_b64(thing): + import pickle +@@ -829,6 +829,13 @@ def _parse_arch(arch_string_raw): + elif re.match(r'^riscv64$|^riscv64be$', arch_string_raw): + arch = 'RISCV_64' + bits = 64 ++ # LoongArch ++ elif arch_string_raw == 'loongarch32': ++ arch = 'LOONGARCH_32' ++ bits = 32 ++ elif arch_string_raw == 'loongarch64': ++ arch = 'LOONGARCH_64' ++ bits = 64 + + return (arch, bits) + +diff --git a/tests/test_invalid_cpu.py b/tests/test_invalid_cpu.py +index d4e75a0..f413d64 100644 +--- a/tests/test_invalid_cpu.py ++++ b/tests/test_invalid_cpu.py +@@ -33,4 +33,4 @@ class TestInvalidCPU(unittest.TestCase): + cpuinfo._check_arch() + self.fail('Failed to raise Exception') + except Exception as err: +- self.assertEqual('py-cpuinfo currently only works on X86 and some ARM/PPC/S390X/MIPS/RISCV CPUs.', err.args[0]) ++ self.assertEqual('py-cpuinfo currently only works on X86 and some ARM/PPC/S390X/MIPS/RISCV/LOONGARCH CPUs.', err.args[0]) +-- +2.43.0 + diff --git a/pycpuinfo.spec b/pycpuinfo.spec index f9f4bef39679a4bbfa0766e9872ce122c5e3d094..6d565c047714bb18dc36e783a1e1cdf0b27f1924 100644 --- a/pycpuinfo.spec +++ b/pycpuinfo.spec @@ -1,11 +1,12 @@ %global _empty_manifest_terminate_build 0 Name: pycpuinfo Version: 9.0.0 -Release: 1 +Release: 2 Summary: Get CPU info with pure Python 2 & 3 License: MIT URL: https://github.com/workhorsy/py-cpuinfo Source0: https://files.pythonhosted.org/packages/37/a8/d832f7293ebb21690860d2e01d8115e5ff6f2ae8bbdc953f0eb0fa4bd2c7/py-cpuinfo-9.0.0.tar.gz +Patch0001: 0001-pycpuinfo-9.0.0-add-loongarch-support.patch BuildArch: noarch @@ -30,7 +31,7 @@ Provides: python3-pycpuinfo-doc Py-cpuinfo gets CPU info with pure Python. %prep -%autosetup -n py-cpuinfo-%{version} +%autosetup -n py-cpuinfo-%{version} -p1 %build %py3_build @@ -70,6 +71,9 @@ mv %{buildroot}/doclist.lst . %{_docdir}/* %changelog +* Thu May 09 2024 Huang Yang - 9.0.0-2 +- add loongarch support + * Wed Nov 16 2022 jiangxinyu - 9.0.0-1 - Update package to version 9.0.0