Fix #101873: wmic not found on insider builds of Windows 11 #101874

Merged
Sergey Sharybin merged 3 commits from xavierh/blender-open-data:xavierh-patch-1 into main 2024-09-30 17:26:53 +02:00
Showing only changes of commit 1d8254acdd - Show all commits

View File

@ -138,26 +138,27 @@ def _get_cpu_topology() -> CPUTopology:
sockets = int(
subprocess.check_output(
(
'wmic',
'computersystem',
'get',
'NumberOfProcessors',
'/value',
'powershell',
'-Command',
'Get-CimInstance Win32_ComputerSystem | Select-Object -ExpandProperty NumberOfProcessors'
),
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
int(core) for core in subprocess.check_output(
(
'powershell',
'-Command',
'Get-CimInstance Win32_Processor | Select-Object -ExpandProperty NumberOfCores'
),
text=True
)
.strip()
.split('\n')
if line.strip()
if core
)
return CPUTopology(sockets=sockets, cores=cores, threads=multiprocessing.cpu_count())