pyhw 0.6.6__tar.gz → 0.6.7__tar.gz
Sign up to get free protection for your applications and to get access to all the features.
- {pyhw-0.6.6/src/pyhw.egg-info → pyhw-0.6.7}/PKG-INFO +1 -1
- {pyhw-0.6.6 → pyhw-0.6.7}/pyproject.toml +1 -1
- pyhw-0.6.7/src/pyhw/backend/host/linux.py +65 -0
- {pyhw-0.6.6 → pyhw-0.6.7}/src/pyhw/backend/shell/unix.py +21 -2
- pyhw-0.6.7/src/pyhw/pyhwUtil/__init__.py +4 -0
- {pyhw-0.6.6 → pyhw-0.6.7}/src/pyhw/pyhwUtil/pyhwUtil.py +8 -0
- {pyhw-0.6.6 → pyhw-0.6.7/src/pyhw.egg-info}/PKG-INFO +1 -1
- pyhw-0.6.6/src/pyhw/backend/host/linux.py +0 -59
- pyhw-0.6.6/src/pyhw/pyhwUtil/__init__.py +0 -4
- {pyhw-0.6.6 → pyhw-0.6.7}/LICENSE +0 -0
- {pyhw-0.6.6 → pyhw-0.6.7}/README.md +0 -0
- {pyhw-0.6.6 → pyhw-0.6.7}/setup.cfg +0 -0
- {pyhw-0.6.6 → pyhw-0.6.7}/src/pyhw/__init__.py +0 -0
- {pyhw-0.6.6 → pyhw-0.6.7}/src/pyhw/__main__.py +0 -0
- {pyhw-0.6.6 → pyhw-0.6.7}/src/pyhw/backend/__init__.py +0 -0
- {pyhw-0.6.6 → pyhw-0.6.7}/src/pyhw/backend/backendBase.py +0 -0
- {pyhw-0.6.6 → pyhw-0.6.7}/src/pyhw/backend/cpu/__init__.py +0 -0
- {pyhw-0.6.6 → pyhw-0.6.7}/src/pyhw/backend/cpu/cpuBase.py +0 -0
- {pyhw-0.6.6 → pyhw-0.6.7}/src/pyhw/backend/cpu/cpuInfo.py +0 -0
- {pyhw-0.6.6 → pyhw-0.6.7}/src/pyhw/backend/cpu/linux.py +0 -0
- {pyhw-0.6.6 → pyhw-0.6.7}/src/pyhw/backend/cpu/macos.py +0 -0
- {pyhw-0.6.6 → pyhw-0.6.7}/src/pyhw/backend/gpu/__init__.py +0 -0
- {pyhw-0.6.6 → pyhw-0.6.7}/src/pyhw/backend/gpu/gpuBase.py +0 -0
- {pyhw-0.6.6 → pyhw-0.6.7}/src/pyhw/backend/gpu/gpuInfo.py +0 -0
- {pyhw-0.6.6 → pyhw-0.6.7}/src/pyhw/backend/gpu/linux.py +0 -0
- {pyhw-0.6.6 → pyhw-0.6.7}/src/pyhw/backend/gpu/macos.py +0 -0
- {pyhw-0.6.6 → pyhw-0.6.7}/src/pyhw/backend/host/__init__.py +0 -0
- {pyhw-0.6.6 → pyhw-0.6.7}/src/pyhw/backend/host/hostBase.py +0 -0
- {pyhw-0.6.6 → pyhw-0.6.7}/src/pyhw/backend/host/hostInfo.py +0 -0
- {pyhw-0.6.6 → pyhw-0.6.7}/src/pyhw/backend/host/macos.py +0 -0
- {pyhw-0.6.6 → pyhw-0.6.7}/src/pyhw/backend/host/windows.py +0 -0
- {pyhw-0.6.6 → pyhw-0.6.7}/src/pyhw/backend/kernel/__init__.py +0 -0
- {pyhw-0.6.6 → pyhw-0.6.7}/src/pyhw/backend/kernel/kernelBase.py +0 -0
- {pyhw-0.6.6 → pyhw-0.6.7}/src/pyhw/backend/kernel/kernelInfo.py +0 -0
- {pyhw-0.6.6 → pyhw-0.6.7}/src/pyhw/backend/kernel/unix.py +0 -0
- {pyhw-0.6.6 → pyhw-0.6.7}/src/pyhw/backend/kernel/windows.py +0 -0
- {pyhw-0.6.6 → pyhw-0.6.7}/src/pyhw/backend/memory/__init__.py +0 -0
- {pyhw-0.6.6 → pyhw-0.6.7}/src/pyhw/backend/memory/linux.py +0 -0
- {pyhw-0.6.6 → pyhw-0.6.7}/src/pyhw/backend/memory/macos.py +0 -0
- {pyhw-0.6.6 → pyhw-0.6.7}/src/pyhw/backend/memory/memoryBase.py +0 -0
- {pyhw-0.6.6 → pyhw-0.6.7}/src/pyhw/backend/memory/memoryInfo.py +0 -0
- {pyhw-0.6.6 → pyhw-0.6.7}/src/pyhw/backend/metal/t.py +0 -0
- {pyhw-0.6.6 → pyhw-0.6.7}/src/pyhw/backend/nic/__init__.py +0 -0
- {pyhw-0.6.6 → pyhw-0.6.7}/src/pyhw/backend/nic/linux.py +0 -0
- {pyhw-0.6.6 → pyhw-0.6.7}/src/pyhw/backend/nic/macos.py +0 -0
- {pyhw-0.6.6 → pyhw-0.6.7}/src/pyhw/backend/nic/nicBase.py +0 -0
- {pyhw-0.6.6 → pyhw-0.6.7}/src/pyhw/backend/nic/nicInfo.py +0 -0
- {pyhw-0.6.6 → pyhw-0.6.7}/src/pyhw/backend/npu/__init__.py +0 -0
- {pyhw-0.6.6 → pyhw-0.6.7}/src/pyhw/backend/npu/linux.py +0 -0
- {pyhw-0.6.6 → pyhw-0.6.7}/src/pyhw/backend/npu/macos.py +0 -0
- {pyhw-0.6.6 → pyhw-0.6.7}/src/pyhw/backend/npu/npuBase.py +0 -0
- {pyhw-0.6.6 → pyhw-0.6.7}/src/pyhw/backend/npu/npuInfo.py +0 -0
- {pyhw-0.6.6 → pyhw-0.6.7}/src/pyhw/backend/os/__init__.py +0 -0
- {pyhw-0.6.6 → pyhw-0.6.7}/src/pyhw/backend/os/linux.py +0 -0
- {pyhw-0.6.6 → pyhw-0.6.7}/src/pyhw/backend/os/macos.py +0 -0
- {pyhw-0.6.6 → pyhw-0.6.7}/src/pyhw/backend/os/osBase.py +0 -0
- {pyhw-0.6.6 → pyhw-0.6.7}/src/pyhw/backend/os/osInfo.py +0 -0
- {pyhw-0.6.6 → pyhw-0.6.7}/src/pyhw/backend/shell/__init__.py +0 -0
- {pyhw-0.6.6 → pyhw-0.6.7}/src/pyhw/backend/shell/shellBase.py +0 -0
- {pyhw-0.6.6 → pyhw-0.6.7}/src/pyhw/backend/title/__init__.py +0 -0
- {pyhw-0.6.6 → pyhw-0.6.7}/src/pyhw/backend/title/titleBase.py +0 -0
- {pyhw-0.6.6 → pyhw-0.6.7}/src/pyhw/backend/title/unix.py +0 -0
- {pyhw-0.6.6 → pyhw-0.6.7}/src/pyhw/backend/title/windows.py +0 -0
- {pyhw-0.6.6 → pyhw-0.6.7}/src/pyhw/backend/uptime/__init__.py +0 -0
- {pyhw-0.6.6 → pyhw-0.6.7}/src/pyhw/backend/uptime/linux.py +0 -0
- {pyhw-0.6.6 → pyhw-0.6.7}/src/pyhw/backend/uptime/macos.py +0 -0
- {pyhw-0.6.6 → pyhw-0.6.7}/src/pyhw/backend/uptime/uptimeBase.py +0 -0
- {pyhw-0.6.6 → pyhw-0.6.7}/src/pyhw/backend/uptime/uptimeInfo.py +0 -0
- {pyhw-0.6.6 → pyhw-0.6.7}/src/pyhw/frontend/__init__.py +0 -0
- {pyhw-0.6.6 → pyhw-0.6.7}/src/pyhw/frontend/color/__init__.py +0 -0
- {pyhw-0.6.6 → pyhw-0.6.7}/src/pyhw/frontend/color/colorConfig.py +0 -0
- {pyhw-0.6.6 → pyhw-0.6.7}/src/pyhw/frontend/color/colorSet.py +0 -0
- {pyhw-0.6.6 → pyhw-0.6.7}/src/pyhw/frontend/color/colorUtil.py +0 -0
- {pyhw-0.6.6 → pyhw-0.6.7}/src/pyhw/frontend/frontendBase.py +0 -0
- {pyhw-0.6.6 → pyhw-0.6.7}/src/pyhw/frontend/logo/__init__.py +0 -0
- {pyhw-0.6.6 → pyhw-0.6.7}/src/pyhw/frontend/logo/ascii/alpine.pyhw +0 -0
- {pyhw-0.6.6 → pyhw-0.6.7}/src/pyhw/frontend/logo/ascii/arch.pyhw +0 -0
- {pyhw-0.6.6 → pyhw-0.6.7}/src/pyhw/frontend/logo/ascii/armbian.pyhw +0 -0
- {pyhw-0.6.6 → pyhw-0.6.7}/src/pyhw/frontend/logo/ascii/centos.pyhw +0 -0
- {pyhw-0.6.6 → pyhw-0.6.7}/src/pyhw/frontend/logo/ascii/debian.pyhw +0 -0
- {pyhw-0.6.6 → pyhw-0.6.7}/src/pyhw/frontend/logo/ascii/fedora.pyhw +0 -0
- {pyhw-0.6.6 → pyhw-0.6.7}/src/pyhw/frontend/logo/ascii/fedora_small.pyhw +0 -0
- {pyhw-0.6.6 → pyhw-0.6.7}/src/pyhw/frontend/logo/ascii/linux.pyhw +0 -0
- {pyhw-0.6.6 → pyhw-0.6.7}/src/pyhw/frontend/logo/ascii/macOS.pyhw +0 -0
- {pyhw-0.6.6 → pyhw-0.6.7}/src/pyhw/frontend/logo/ascii/raspbian.pyhw +0 -0
- {pyhw-0.6.6 → pyhw-0.6.7}/src/pyhw/frontend/logo/ascii/ubuntu.pyhw +0 -0
- {pyhw-0.6.6 → pyhw-0.6.7}/src/pyhw/frontend/logo/ascii/ubuntu_small.pyhw +0 -0
- {pyhw-0.6.6 → pyhw-0.6.7}/src/pyhw/frontend/logo/logoBase.py +0 -0
- {pyhw-0.6.6 → pyhw-0.6.7}/src/pyhw/library/lib/iokitGPULib.dylib +0 -0
- {pyhw-0.6.6 → pyhw-0.6.7}/src/pyhw/macos.py +0 -0
- {pyhw-0.6.6 → pyhw-0.6.7}/src/pyhw/pyhwException/__init__.py +0 -0
- {pyhw-0.6.6 → pyhw-0.6.7}/src/pyhw/pyhwException/pyhwException.py +0 -0
- {pyhw-0.6.6 → pyhw-0.6.7}/src/pyhw/pyhwUtil/sysctlUtil.py +0 -0
- {pyhw-0.6.6 → pyhw-0.6.7}/src/pyhw.egg-info/SOURCES.txt +0 -0
- {pyhw-0.6.6 → pyhw-0.6.7}/src/pyhw.egg-info/dependency_links.txt +0 -0
- {pyhw-0.6.6 → pyhw-0.6.7}/src/pyhw.egg-info/entry_points.txt +0 -0
- {pyhw-0.6.6 → pyhw-0.6.7}/src/pyhw.egg-info/requires.txt +0 -0
- {pyhw-0.6.6 → pyhw-0.6.7}/src/pyhw.egg-info/top_level.txt +0 -0
@@ -4,7 +4,7 @@ build-backend = "setuptools.build_meta"
|
|
4
4
|
|
5
5
|
[project]
|
6
6
|
name = "pyhw"
|
7
|
-
version = "0.6.
|
7
|
+
version = "0.6.7"
|
8
8
|
description = "PyHw, a neofetch-like command line tool for fetching system information but written mostly in python."
|
9
9
|
keywords = ["neofetch", "system information", "command line tool", "python", "hardware information", "fastfetch", "fetching"]
|
10
10
|
authors = [
|
@@ -0,0 +1,65 @@
|
|
1
|
+
"""
|
2
|
+
In dev.
|
3
|
+
"""
|
4
|
+
from ...pyhwUtil import getArch, getDocker
|
5
|
+
from .hostInfo import HostInfo
|
6
|
+
import os
|
7
|
+
|
8
|
+
|
9
|
+
class HostDetectLinux:
|
10
|
+
def __init__(self):
|
11
|
+
self.__hostInfo = HostInfo()
|
12
|
+
self.__arch = getArch()
|
13
|
+
self.__docker = getDocker()
|
14
|
+
|
15
|
+
def getHostInfo(self):
|
16
|
+
self.__getModel()
|
17
|
+
return self.__hostInfo
|
18
|
+
|
19
|
+
def __getModel(self):
|
20
|
+
if self.__docker:
|
21
|
+
self.__hostInfo.name = f"General {self.__arch} Docker Host"
|
22
|
+
self.__hostInfo.version = ""
|
23
|
+
self.__hostInfo.model = self.__hostInfo.name + " " + self.__hostInfo.version
|
24
|
+
else:
|
25
|
+
if self.__arch in ["x86_64", "x86"]:
|
26
|
+
try:
|
27
|
+
with open("/sys/devices/virtual/dmi/id/product_name", "r") as f:
|
28
|
+
product_name = f.read().strip()
|
29
|
+
if product_name.startswith("To be filled by O.E.M."):
|
30
|
+
self.__hostInfo.name = f"General {self.__arch} Host"
|
31
|
+
else:
|
32
|
+
self.__hostInfo.name = product_name
|
33
|
+
with open("/sys/devices/virtual/dmi/id/product_version", "r") as f:
|
34
|
+
version = f.read().strip()
|
35
|
+
if version.startswith("To be filled by O.E.M."):
|
36
|
+
self.__hostInfo.version = ""
|
37
|
+
else:
|
38
|
+
self.__hostInfo.version = version
|
39
|
+
self.__hostInfo.model = self.__hostInfo.name + " " + self.__hostInfo.version
|
40
|
+
except FileNotFoundError:
|
41
|
+
pass
|
42
|
+
elif self.__arch in ["aarch64", "arm32"]:
|
43
|
+
# try to find dmi folder since some arm based desktops and servers may have same structure as x86_64 machines.
|
44
|
+
if os.path.exists("/sys/devices/virtual/dmi/id"):
|
45
|
+
try:
|
46
|
+
with open("/sys/devices/virtual/dmi/id/product_name", "r") as f:
|
47
|
+
self.__hostInfo.name = f.read().strip()
|
48
|
+
with open("/sys/devices/virtual/dmi/id/product_version", "r") as f:
|
49
|
+
self.__hostInfo.version = f.read().strip()
|
50
|
+
self.__hostInfo.model = self.__hostInfo.name + " " + self.__hostInfo.version
|
51
|
+
except FileNotFoundError:
|
52
|
+
pass
|
53
|
+
else:
|
54
|
+
# some single board computers may not have dmi folder, try to find model name in device tree.
|
55
|
+
try:
|
56
|
+
with open("/sys/firmware/devicetree/base/model", "r") as f:
|
57
|
+
self.__hostInfo.model = f.read().strip()
|
58
|
+
except FileNotFoundError:
|
59
|
+
pass
|
60
|
+
|
61
|
+
def __getHostFamily(self):
|
62
|
+
pass
|
63
|
+
|
64
|
+
def __getHostProductName(self):
|
65
|
+
pass
|
@@ -1,6 +1,7 @@
|
|
1
1
|
"""
|
2
2
|
In dev.
|
3
3
|
"""
|
4
|
+
from ...pyhwUtil import getDocker
|
4
5
|
from dataclasses import dataclass
|
5
6
|
import os
|
6
7
|
import subprocess
|
@@ -19,9 +20,13 @@ class ShellDetectUnix:
|
|
19
20
|
self.__shellInfo = ShellInfoUnix()
|
20
21
|
|
21
22
|
def getShellInfo(self):
|
22
|
-
|
23
|
+
if getDocker():
|
24
|
+
self.__getShellDocker()
|
25
|
+
else:
|
26
|
+
self.__getShell()
|
23
27
|
self.__getVersion()
|
24
28
|
self.__shellInfo.info = self.__shellInfo.shell + " " + self.__shellInfo.version
|
29
|
+
print(self.__shellInfo.info)
|
25
30
|
return self.__shellInfo
|
26
31
|
|
27
32
|
def __getShell(self):
|
@@ -31,6 +36,19 @@ class ShellDetectUnix:
|
|
31
36
|
self.__shellInfo.shell = shell_env.split("/")[-1]
|
32
37
|
self.__shellInfo.path = shell_env
|
33
38
|
|
39
|
+
def __getShellDocker(self):
|
40
|
+
try:
|
41
|
+
with open("/etc/passwd", "r") as f:
|
42
|
+
for line in f:
|
43
|
+
if line.startswith("root:"):
|
44
|
+
root_shell = line.strip().split(":")[-1]
|
45
|
+
break
|
46
|
+
except:
|
47
|
+
root_shell = ""
|
48
|
+
if root_shell != "":
|
49
|
+
self.__shellInfo.shell = root_shell.split("/")[-1]
|
50
|
+
self.__shellInfo.path = root_shell
|
51
|
+
|
34
52
|
def __getVersion(self):
|
35
53
|
shell = self.__shellInfo.shell
|
36
54
|
if shell != "":
|
@@ -39,7 +57,7 @@ class ShellDetectUnix:
|
|
39
57
|
elif shell == "bash":
|
40
58
|
try:
|
41
59
|
result = subprocess.run(["bash", "-c", "echo $BASH_VERSION"], capture_output=True, text=True)
|
42
|
-
self.__shellInfo.version = result.stdout.strip()
|
60
|
+
self.__shellInfo.version = result.stdout.strip().split("(")[0]
|
43
61
|
except subprocess.SubprocessError:
|
44
62
|
pass
|
45
63
|
elif shell == "zsh":
|
@@ -54,3 +72,4 @@ class ShellDetectUnix:
|
|
54
72
|
|
55
73
|
|
56
74
|
|
75
|
+
|
@@ -38,6 +38,14 @@ def getArch():
|
|
38
38
|
return "unknown"
|
39
39
|
|
40
40
|
|
41
|
+
def getDocker() -> bool:
|
42
|
+
"""
|
43
|
+
Check if the current environment is running in Docker.
|
44
|
+
:return: bool, True if running in Docker, False otherwise.
|
45
|
+
"""
|
46
|
+
return os.path.exists("/.dockerenv")
|
47
|
+
|
48
|
+
|
41
49
|
class DataStringProcessor:
|
42
50
|
def __init__(self, data: Data):
|
43
51
|
self.data = data
|
@@ -1,59 +0,0 @@
|
|
1
|
-
"""
|
2
|
-
In dev.
|
3
|
-
"""
|
4
|
-
from ...pyhwUtil import getArch
|
5
|
-
from .hostInfo import HostInfo
|
6
|
-
import os
|
7
|
-
|
8
|
-
|
9
|
-
class HostDetectLinux:
|
10
|
-
def __init__(self):
|
11
|
-
self.__hostInfo = HostInfo()
|
12
|
-
self.__arch = getArch()
|
13
|
-
|
14
|
-
def getHostInfo(self):
|
15
|
-
self.__getModel()
|
16
|
-
return self.__hostInfo
|
17
|
-
|
18
|
-
def __getModel(self):
|
19
|
-
if self.__arch in ["x86_64", "x86"]:
|
20
|
-
try:
|
21
|
-
with open("/sys/devices/virtual/dmi/id/product_name", "r") as f:
|
22
|
-
product_name = f.read().strip()
|
23
|
-
if product_name.startswith("To be filled by O.E.M."):
|
24
|
-
self.__hostInfo.name = f"General {self.__arch} Host"
|
25
|
-
else:
|
26
|
-
self.__hostInfo.name = product_name
|
27
|
-
with open("/sys/devices/virtual/dmi/id/product_version", "r") as f:
|
28
|
-
version = f.read().strip()
|
29
|
-
if version.startswith("To be filled by O.E.M."):
|
30
|
-
self.__hostInfo.version = ""
|
31
|
-
else:
|
32
|
-
self.__hostInfo.version = version
|
33
|
-
self.__hostInfo.model = self.__hostInfo.name + " " + self.__hostInfo.version
|
34
|
-
except FileNotFoundError:
|
35
|
-
pass
|
36
|
-
elif self.__arch in ["aarch64", "arm32"]:
|
37
|
-
# try to find dmi folder since some arm based desktops and servers may have same structure as x86_64 machines.
|
38
|
-
if os.path.exists("/sys/devices/virtual/dmi/id"):
|
39
|
-
try:
|
40
|
-
with open("/sys/devices/virtual/dmi/id/product_name", "r") as f:
|
41
|
-
self.__hostInfo.name = f.read().strip()
|
42
|
-
with open("/sys/devices/virtual/dmi/id/product_version", "r") as f:
|
43
|
-
self.__hostInfo.version = f.read().strip()
|
44
|
-
self.__hostInfo.model = self.__hostInfo.name + " " + self.__hostInfo.version
|
45
|
-
except FileNotFoundError:
|
46
|
-
pass
|
47
|
-
else:
|
48
|
-
# some single board computers may not have dmi folder, try to find model name in device tree.
|
49
|
-
try:
|
50
|
-
with open("/sys/firmware/devicetree/base/model", "r") as f:
|
51
|
-
self.__hostInfo.model = f.read().strip()
|
52
|
-
except FileNotFoundError:
|
53
|
-
pass
|
54
|
-
|
55
|
-
def __getHostFamily(self):
|
56
|
-
pass
|
57
|
-
|
58
|
-
def __getHostProductName(self):
|
59
|
-
pass
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|