代码拉取完成,页面将自动刷新
From e167c73cf7fc6b93e72a8de1f2c31805587e31bb Mon Sep 17 00:00:00 2001
From: Huang Yang <huangyang@loongson.cn>
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
此处可能存在不合适展示的内容,页面不予展示。您可通过相关编辑功能自查并修改。
如您确认内容无涉及 不当用语 / 纯广告导流 / 暴力 / 低俗色情 / 侵权 / 盗版 / 虚假 / 无价值内容或违法国家有关法律法规的内容,可点击提交进行申诉,我们将尽快为您处理。