Send patches - preferably formatted by git format-patch - to patches at archlinux32 dot org.
summaryrefslogtreecommitdiff
path: root/archinstall/lib/hardware.py
diff options
context:
space:
mode:
authorCYPT71 <51490865+CYPT71@users.noreply.github.com>2021-07-22 11:47:56 +0200
committerGitHub <noreply@github.com>2021-07-22 11:47:56 +0200
commitbbce3aa26afc3d55831954231579a5456b0da61a (patch)
tree657c4f34325e2effee7e0d301e3060ff9d59c227 /archinstall/lib/hardware.py
parent3a4076419418dcdac538c543903cfc6e16bde35f (diff)
Update hardware.py
Rewrite some function if condition is True then return true else return false, transform in return condition directly Also I don't understand why we need a try/except at line 151 and why we not write return condition ??
Diffstat (limited to 'archinstall/lib/hardware.py')
-rw-r--r--archinstall/lib/hardware.py13
1 files changed, 7 insertions, 6 deletions
diff --git a/archinstall/lib/hardware.py b/archinstall/lib/hardware.py
index a63155f5..d040c19a 100644
--- a/archinstall/lib/hardware.py
+++ b/archinstall/lib/hardware.py
@@ -69,10 +69,7 @@ def has_amd_cpu() -> bool:
def has_intel_cpu() -> bool:
- if subprocess.check_output("lscpu | grep Intel", shell=True).strip().decode():
- return True
- return False
-
+ return subprocess.check_output("lscpu | grep Intel", shell=True).strip().decode()
def has_uefi() -> bool:
return os.path.isdir('/sys/firmware/efi')
@@ -106,7 +103,7 @@ def cpu_vendor() -> Optional[str]:
for info in cpu_info:
if info.get('field', None) == "Vendor ID:":
return info.get('data', None)
- return None
+ return
def cpu_model() -> Optional[str]:
@@ -116,7 +113,7 @@ def cpu_model() -> Optional[str]:
for info in cpu_info:
if info.get('field', None) == "Model name:":
return info.get('data', None)
- return None
+ return
def sys_vendor() -> Optional[str]:
@@ -151,6 +148,8 @@ def virtualization() -> Optional[str]:
def is_vm() -> bool:
+ return b"none" not in b"".join(SysCommand("systemd-detect-virt")).lower()
+ """
try:
# systemd-detect-virt issues a non-zero exit code if it is not on a virtual machine
if b"none" not in b"".join(SysCommand("systemd-detect-virt")).lower():
@@ -159,5 +158,7 @@ def is_vm() -> bool:
pass
return False
+
+ """
# TODO: Add more identifiers