mirror of
https://gitlab.alpinelinux.org/alpine/aports.git
synced 2025-11-08 12:22:15 +01:00
Changing the exception message in `cpuinfo.py`, without also doing so in `test_invalid_cpu.py` causes tests to fail due to not getting the expected exception message.
45 lines
1.6 KiB
Diff
45 lines
1.6 KiB
Diff
reference from:
|
|
https://github.com/workhorsy/py-cpuinfo/pull/194
|
|
https://github.com/workhorsy/py-cpuinfo/commit/74cdfa3badde130c9c7e755a6c3858e4b99d8c4c
|
|
|
|
omit loongarch64 tests
|
|
--
|
|
diff --git a/cpuinfo/cpuinfo.py b/cpuinfo/cpuinfo.py
|
|
index ea2f90e..f89ce00 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', 'LOONG_32', 'LOONG_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 re.match(r'^loongarch32$', arch_string_raw):
|
|
+ arch = 'LOONG_32'
|
|
+ bits = 32
|
|
+ elif re.match(r'^loongarch64$', arch_string_raw):
|
|
+ arch = 'LOONG_64'
|
|
+ bits = 64
|
|
|
|
return (arch, bits)
|
|
|
|
--- a/tests/test_invalid_cpu.py
|
|
+++ b/tests/test_invalid_cpu.py
|
|
@@ -33,4 +33,4 @@
|
|
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])
|