From 58e60aea8ed8a1a4e9898c72785099e732a2dd82 Mon Sep 17 00:00:00 2001 From: Azalea Gui Date: Fri, 24 Feb 2023 09:55:09 -0500 Subject: [PATCH] [F] ARM CPU Detection: Compatibility with clusters #97 --- neofetch | 12 +++++++++--- 1 file changed, 9 insertions(+), 3 deletions(-) diff --git a/neofetch b/neofetch index 9bdf2bde..53187d2a 100755 --- a/neofetch +++ b/neofetch @@ -2647,7 +2647,8 @@ from subprocess import check_output def find(lines, label): for ln in lines: if ln.strip().startswith(label): - return ln.split(label)[-1].strip() + t = ln.split(label)[-1].strip() + return None if t == '-' else t return None @@ -2662,8 +2663,13 @@ if __name__ == '__main__': for model_desc in lscpu.split('Model name:'): lines = model_desc.split('\n') model = lines[0].strip() - cores = int(find(lines, 'Core(s) per socket:') or "-1") - cores *= int(find(lines, 'Socket(s):') or "1") + + cores = find(lines, 'Core(s) per socket:') or find(lines, 'Core(s) per cluster:') + if cores is None: + continue + + cores = int(cores) + cores *= int(find(lines, 'Socket(s):') or find(lines, 'Cluster(s):') or "1") if cores == -1: continue