|
|
@ -3,8 +3,7 @@ import platform, subprocess |
|
|
|
|
|
|
|
def getcpu(): |
|
|
|
# find the CPU name (which needs a different method per OS), and return it |
|
|
|
# return None if none found |
|
|
|
# works on Linux, MacOS (aka OSX), Windows |
|
|
|
# If none found, return platform.platform(). |
|
|
|
|
|
|
|
cputype = None |
|
|
|
|
|
|
@ -25,15 +24,17 @@ def getcpu(): |
|
|
|
# model name : Intel(R) Xeon(R) CPU E5335 @ 2.00GHz |
|
|
|
cputype = myline.split(":", 1)[1] # get everything after the first ":" |
|
|
|
break # we're done |
|
|
|
|
|
|
|
except: |
|
|
|
# An exception, maybe due to a subprocess call gone wrong |
|
|
|
cputype = "Unknown" |
|
|
|
pass |
|
|
|
|
|
|
|
if cputype: |
|
|
|
# remove unnneeded space: |
|
|
|
# OK, found. Remove unnneeded spaces: |
|
|
|
cputype = " ".join(cputype.split()) |
|
|
|
else: |
|
|
|
# Not found, so let's fall back to platform() |
|
|
|
cputype = platform.platform() |
|
|
|
|
|
|
|
return cputype |
|
|
|
|
|
|
|
|
|
|
|