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 json
|
||||||
import os
|
import os
|
||||||
import subprocess
|
|
||||||
from pathlib import Path
|
from pathlib import Path
|
||||||
from typing import Iterator, Optional
|
from typing import Iterator, Optional
|
||||||
|
|
||||||
|
|
@ -82,15 +81,11 @@ def has_wifi() -> bool:
|
||||||
|
|
||||||
|
|
||||||
def has_amd_cpu() -> bool:
|
def has_amd_cpu() -> bool:
|
||||||
if subprocess.check_output("lscpu | grep AMD", shell=True).strip().decode():
|
return any(cpu.get("vendor_id") == "AuthenticAMD" for cpu in cpuinfo())
|
||||||
return True
|
|
||||||
return False
|
|
||||||
|
|
||||||
|
|
||||||
def has_intel_cpu() -> bool:
|
def has_intel_cpu() -> bool:
|
||||||
if subprocess.check_output("lscpu | grep Intel", shell=True).strip().decode():
|
return any(cpu.get("vendor_id") == "GenuineIntel" for cpu in cpuinfo())
|
||||||
return True
|
|
||||||
return False
|
|
||||||
|
|
||||||
|
|
||||||
def has_uefi() -> bool:
|
def has_uefi() -> bool:
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue