Send patches - preferably formatted by git format-patch - to patches at archlinux32 dot org.
summaryrefslogtreecommitdiff
path: root/archinstall
diff options
context:
space:
mode:
authorRichard Neumann <mail@richard-neumann.de>2021-10-21 22:54:00 +0200
committerRichard Neumann <mail@richard-neumann.de>2021-10-21 22:54:00 +0200
commit63c6f39f98efcaa644d2d64c2e9468cb240a32dd (patch)
tree4b15e56de6e2cfda7da6d5484c71b255901173d2 /archinstall
parent4f6cec5069023198b047cb61e3e65fb37a93d577 (diff)
Generalize CPU vendor detection
Implement has_amd_cpu() and has_intel_cpu() as partials.
Diffstat (limited to 'archinstall')
-rw-r--r--archinstall/lib/hardware.py9
1 files changed, 5 insertions, 4 deletions
diff --git a/archinstall/lib/hardware.py b/archinstall/lib/hardware.py
index 4f8192e4..7172628b 100644
--- a/archinstall/lib/hardware.py
+++ b/archinstall/lib/hardware.py
@@ -1,4 +1,5 @@
import os
+from functools import partial
from pathlib import Path
from typing import Iterator, Optional, Union
@@ -95,11 +96,11 @@ def has_wifi() -> bool:
return 'WIRELESS' in enrich_iface_types(list_interfaces().values()).values()
-def has_amd_cpu() -> bool:
- return any(cpu.get("vendor_id") == "AuthenticAMD" for cpu in cpuinfo())
+def has_cpu_vendor(vendor_id: str) -> bool:
+ return any(cpu.get("vendor_id") == vendor_id for cpu in cpuinfo())
-def has_intel_cpu() -> bool:
- return any(cpu.get("vendor_id") == "GenuineIntel" for cpu in cpuinfo())
+has_amd_cpu = partial(has_cpu_vendor, "AuthenticAMD")
+has_intel_cpu = partial(has_cpu_vendor, "GenuineIntel")
def has_uefi() -> bool:
return os.path.isdir('/sys/firmware/efi')