Split CPU ID string on Windows.

这个提交包含在:
Craig Warren
2017-02-27 15:35:24 +00:00
父节点 21437b8b2b
当前提交 561554e6cb

查看文件

@@ -171,8 +171,10 @@ def get_host_info():
# CPU information # CPU information
allcpuinfo = subprocess.check_output("wmic cpu get Name", shell=True).decode('utf-8').strip() allcpuinfo = subprocess.check_output("wmic cpu get Name", shell=True).decode('utf-8').strip()
allcpuinfo = allcpuinfo.split('\n')
sockets = 0 sockets = 0
for line in allcpuinfo: for line in allcpuinfo:
print(line)
if 'CPU' in line: if 'CPU' in line:
cpuID = line.strip() cpuID = line.strip()
sockets += 1 sockets += 1
@@ -183,9 +185,9 @@ def get_host_info():
# OS version # OS version
if platform.machine().endswith('64'): if platform.machine().endswith('64'):
osbit = '(64-bit)' osbit = ' (64-bit)'
else: else:
osbit = '(32-bit)' osbit = ' (32-bit)'
osversion = 'Windows ' + platform.release() + osbit osversion = 'Windows ' + platform.release() + osbit
# Mac OS X/macOS # Mac OS X/macOS