Skip to content

Commit 65391f6

Browse files
[BUGFIX] CPU information regex fix (automatic-ripping-machine#1446)
* CPU info regex fix automatic-ripping-machine#1381 Bugfix for linux cpu, removed Intel, AMD and ARM checks, now all just report the model info if found * Version bump - bugfix
1 parent 2036809 commit 65391f6

2 files changed

Lines changed: 10 additions & 24 deletions

File tree

VERSION

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
2.17.2
1+
2.17.3

arm/models/system_info.py

Lines changed: 9 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -38,31 +38,17 @@ def get_cpu_info(self):
3838
elif platform.system() == "Linux":
3939
command = "cat /proc/cpuinfo"
4040
fulldump = subprocess.check_output(command, shell=True).decode()
41-
# logging.debug(f"Full cpuinfo: {fulldump}")
4241

43-
# Take any float trailing "MHz", some whitespace, and a colon.
44-
# like: model name : Intel(R) Celeron(R) G4930T CPU @ 3.00GHz
45-
intel_match = re.search(r"model name\s*:\s*(.*?GHz)", fulldump)
46-
logging.debug(f"Intel output: {intel_match}")
47-
if intel_match:
48-
self.cpu = intel_match.group(1)
49-
50-
# AMD CPU
51-
amd_name_full = re.search(r"model name\s*:\s*(.*)", fulldump)
52-
logging.debug(f"AMD output: {amd_name_full}")
53-
if amd_name_full:
54-
amd_name = amd_name_full.group(1)
55-
amd_mhz = re.search(r"cpu MHz\s*:\s*([.0-9]+)", fulldump) # noqa: W605
56-
if amd_mhz:
57-
amd_ghz = round(float(amd_mhz.group(1)) / 1000, 2) # this is a good idea
58-
self.cpu = str(amd_name) + " @ " + str(amd_ghz) + " GHz"
59-
60-
# ARM64 CPU
61-
arm_cpu = re.search(r"model name\s*:\s*(.*)n", fulldump)
62-
logging.debug(f"ARM64 output: {arm_cpu}")
63-
if arm_cpu:
64-
self.cpu = str(arm_cpu.group(1))[:19]
42+
# Find the CPU Model Name
43+
# Intel model name : Intel(R) Celeron(R) G4930T CPU @ 3.00GHz
44+
# amd model name : AMD Ryzen 5 3600 6-Core Processor
45+
# arm model name : ARMv8 Processor rev 3 (v8l)
46+
regex_match = re.search(r"model name\s*:\s*(.*)", fulldump)
47+
logging.debug(f"Regex output: {regex_match}")
48+
if regex_match:
49+
self.cpu = regex_match.group(1)
6550

51+
logging.debug(f"CPU Info: {self.cpu}")
6652
logging.debug("****************************")
6753

6854
def get_memory(self):

0 commit comments

Comments
 (0)