From 1ef52f56cb1c9a3d5568241bd83227af336a9a6e Mon Sep 17 00:00:00 2001 From: Dee <97798233+dee-fox@users.noreply.github.com> Date: Mon, 8 Sep 2025 13:51:28 +0300 Subject: [PATCH] gracefully return "undefined" if DMI is not in sysfs (#3771) * gracefully return "undefined" if DMI is not in sysfs fixes #3770, in theory * None works too and is consistent with other behaviour * None doesn't *just* work --- archinstall/lib/hardware.py | 18 ++++++++++++------ 1 file changed, 12 insertions(+), 6 deletions(-) diff --git a/archinstall/lib/hardware.py b/archinstall/lib/hardware.py index 12d52df4..e1278dfa 100644 --- a/archinstall/lib/hardware.py +++ b/archinstall/lib/hardware.py @@ -239,14 +239,20 @@ class SysInfo: return _sys_info.cpu_info.get('model name', None) @staticmethod - def sys_vendor() -> str: - with open('/sys/devices/virtual/dmi/id/sys_vendor') as vendor: - return vendor.read().strip() + def sys_vendor() -> str | None: + try: + with open('/sys/devices/virtual/dmi/id/sys_vendor') as vendor: + return vendor.read().strip() + except FileNotFoundError: + return None @staticmethod - def product_name() -> str: - with open('/sys/devices/virtual/dmi/id/product_name') as product: - return product.read().strip() + def product_name() -> str | None: + try: + with open('/sys/devices/virtual/dmi/id/product_name') as product: + return product.read().strip() + except FileNotFoundError: + return None @staticmethod def mem_available() -> int: