Fix #101873: wmic not found on insider builds of Windows 11 #101874
@ -135,6 +135,7 @@ def _get_cpu_topology() -> CPUTopology:
|
||||
sockets = cores_info.get_physical_processors_count()
|
||||
cores = cores_info.get_physical_cores_count()
|
||||
else:
|
||||
if sys.getwindowsversion().major >= 10:
|
||||
sockets = int(
|
||||
subprocess.check_output(
|
||||
(
|
||||
@ -160,6 +161,31 @@ def _get_cpu_topology() -> CPUTopology:
|
||||
.split('\n')
|
||||
if core
|
||||
)
|
||||
else:
|
||||
sockets = int(
|
||||
subprocess.check_output(
|
||||
(
|
||||
'wmic',
|
||||
'computersystem',
|
||||
'get',
|
||||
'NumberOfProcessors',
|
||||
'/value',
|
||||
),
|
||||
text=True,
|
||||
)
|
||||
.strip()
|
||||
.split('=')[1]
|
||||
)
|
||||
|
||||
cores = sum(
|
||||
int(line.strip().split('=')[1])
|
||||
for line in subprocess.check_output(
|
||||
('wmic', 'cpu', 'get', 'NumberOfCores', '/value'), text=True
|
||||
)
|
||||
.strip()
|
||||
.split('\n')
|
||||
if line.strip()
|
||||
)
|
||||
|
||||
return CPUTopology(sockets=sockets, cores=cores, threads=multiprocessing.cpu_count())
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user