From 63c6f39f98efcaa644d2d64c2e9468cb240a32dd Mon Sep 17 00:00:00 2001 From: Richard Neumann Date: Thu, 21 Oct 2021 22:54:00 +0200 Subject: Generalize CPU vendor detection Implement has_amd_cpu() and has_intel_cpu() as partials. --- archinstall/lib/hardware.py | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) (limited to 'archinstall') 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') -- cgit v1.2.3-70-g09d2