Rewrite CPU vendor detection functions
Use cpuinfo() function rather than a subprocess.
This commit is contained in:
parent
b8ede1b333
commit
61947ab944
|
|
@ -1,6 +1,5 @@
|
|||
import json
|
||||
import os
|
||||
import subprocess
|
||||
from pathlib import Path
|
||||
from typing import Iterator, Optional
|
||||
|
||||
|
|
@ -82,15 +81,11 @@ def has_wifi() -> bool:
|
|||
|
||||
|
||||
def has_amd_cpu() -> bool:
|
||||
if subprocess.check_output("lscpu | grep AMD", shell=True).strip().decode():
|
||||
return True
|
||||
return False
|
||||
return any(cpu.get("vendor_id") == "AuthenticAMD" for cpu in cpuinfo())
|
||||
|
||||
|
||||
def has_intel_cpu() -> bool:
|
||||
if subprocess.check_output("lscpu | grep Intel", shell=True).strip().decode():
|
||||
return True
|
||||
return False
|
||||
return any(cpu.get("vendor_id") == "GenuineIntel" for cpu in cpuinfo())
|
||||
|
||||
|
||||
def has_uefi() -> bool:
|
||||
|
|
|
|||
Loading…
Reference in New Issue