pyhw 0.13.3__tar.gz → 0.14.0__tar.gz
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- {pyhw-0.13.3/src/pyhw.egg-info → pyhw-0.14.0}/PKG-INFO +2 -2
- {pyhw-0.13.3 → pyhw-0.14.0}/pyproject.toml +2 -2
- {pyhw-0.13.3 → pyhw-0.14.0}/src/pyhw/__init__.py +1 -1
- {pyhw-0.13.3 → pyhw-0.14.0}/src/pyhw/__main__.py +90 -22
- {pyhw-0.13.3 → pyhw-0.14.0}/src/pyhw/backend/gpu/linux.py +2 -2
- {pyhw-0.13.3 → pyhw-0.14.0}/src/pyhw/backend/gpu/windows.py +2 -2
- {pyhw-0.13.3 → pyhw-0.14.0}/src/pyhw/backend/nic/linux.py +2 -2
- {pyhw-0.13.3 → pyhw-0.14.0}/src/pyhw/backend/nic/windows.py +2 -2
- {pyhw-0.13.3 → pyhw-0.14.0}/src/pyhw/backend/npu/linux.py +2 -2
- {pyhw-0.13.3 → pyhw-0.14.0}/src/pyhw/backend/npu/windows.py +2 -2
- {pyhw-0.13.3 → pyhw-0.14.0}/src/pyhw/backend/os/macos.py +11 -2
- pyhw-0.14.0/src/pyhw/pyhwUtil/__init__.py +16 -0
- {pyhw-0.13.3 → pyhw-0.14.0}/src/pyhw/pyhwUtil/cliUtil.py +5 -2
- pyhw-0.14.0/src/pyhw/pyhwUtil/pciUtil.py +11 -0
- {pyhw-0.13.3 → pyhw-0.14.0/src/pyhw.egg-info}/PKG-INFO +2 -2
- {pyhw-0.13.3 → pyhw-0.14.0}/src/pyhw.egg-info/SOURCES.txt +1 -0
- pyhw-0.14.0/src/pyhw.egg-info/requires.txt +1 -0
- pyhw-0.13.3/src/pyhw/pyhwUtil/__init__.py +0 -6
- pyhw-0.13.3/src/pyhw.egg-info/requires.txt +0 -1
- {pyhw-0.13.3 → pyhw-0.14.0}/LICENSE +0 -0
- {pyhw-0.13.3 → pyhw-0.14.0}/README.md +0 -0
- {pyhw-0.13.3 → pyhw-0.14.0}/setup.cfg +0 -0
- {pyhw-0.13.3 → pyhw-0.14.0}/src/pyhw/backend/__init__.py +0 -0
- {pyhw-0.13.3 → pyhw-0.14.0}/src/pyhw/backend/backendBase.py +0 -0
- {pyhw-0.13.3 → pyhw-0.14.0}/src/pyhw/backend/cpu/__init__.py +0 -0
- {pyhw-0.13.3 → pyhw-0.14.0}/src/pyhw/backend/cpu/bsd.py +0 -0
- {pyhw-0.13.3 → pyhw-0.14.0}/src/pyhw/backend/cpu/cpuBase.py +0 -0
- {pyhw-0.13.3 → pyhw-0.14.0}/src/pyhw/backend/cpu/cpuInfo.py +0 -0
- {pyhw-0.13.3 → pyhw-0.14.0}/src/pyhw/backend/cpu/linux.py +0 -0
- {pyhw-0.13.3 → pyhw-0.14.0}/src/pyhw/backend/cpu/macos.py +0 -0
- {pyhw-0.13.3 → pyhw-0.14.0}/src/pyhw/backend/cpu/windows.py +0 -0
- {pyhw-0.13.3 → pyhw-0.14.0}/src/pyhw/backend/gpu/__init__.py +0 -0
- {pyhw-0.13.3 → pyhw-0.14.0}/src/pyhw/backend/gpu/bsd.py +0 -0
- {pyhw-0.13.3 → pyhw-0.14.0}/src/pyhw/backend/gpu/gpuBase.py +0 -0
- {pyhw-0.13.3 → pyhw-0.14.0}/src/pyhw/backend/gpu/gpuInfo.py +0 -0
- {pyhw-0.13.3 → pyhw-0.14.0}/src/pyhw/backend/gpu/macos.py +0 -0
- {pyhw-0.13.3 → pyhw-0.14.0}/src/pyhw/backend/host/__init__.py +0 -0
- {pyhw-0.13.3 → pyhw-0.14.0}/src/pyhw/backend/host/bsd.py +0 -0
- {pyhw-0.13.3 → pyhw-0.14.0}/src/pyhw/backend/host/hostBase.py +0 -0
- {pyhw-0.13.3 → pyhw-0.14.0}/src/pyhw/backend/host/hostInfo.py +0 -0
- {pyhw-0.13.3 → pyhw-0.14.0}/src/pyhw/backend/host/linux.py +0 -0
- {pyhw-0.13.3 → pyhw-0.14.0}/src/pyhw/backend/host/macos.py +0 -0
- {pyhw-0.13.3 → pyhw-0.14.0}/src/pyhw/backend/host/windows.py +0 -0
- {pyhw-0.13.3 → pyhw-0.14.0}/src/pyhw/backend/kernel/__init__.py +0 -0
- {pyhw-0.13.3 → pyhw-0.14.0}/src/pyhw/backend/kernel/kernelBase.py +0 -0
- {pyhw-0.13.3 → pyhw-0.14.0}/src/pyhw/backend/kernel/kernelInfo.py +0 -0
- {pyhw-0.13.3 → pyhw-0.14.0}/src/pyhw/backend/kernel/unix.py +0 -0
- {pyhw-0.13.3 → pyhw-0.14.0}/src/pyhw/backend/kernel/windows.py +0 -0
- {pyhw-0.13.3 → pyhw-0.14.0}/src/pyhw/backend/memory/__init__.py +0 -0
- {pyhw-0.13.3 → pyhw-0.14.0}/src/pyhw/backend/memory/bsd.py +0 -0
- {pyhw-0.13.3 → pyhw-0.14.0}/src/pyhw/backend/memory/linux.py +0 -0
- {pyhw-0.13.3 → pyhw-0.14.0}/src/pyhw/backend/memory/macos.py +0 -0
- {pyhw-0.13.3 → pyhw-0.14.0}/src/pyhw/backend/memory/memoryBase.py +0 -0
- {pyhw-0.13.3 → pyhw-0.14.0}/src/pyhw/backend/memory/memoryInfo.py +0 -0
- {pyhw-0.13.3 → pyhw-0.14.0}/src/pyhw/backend/memory/windows.py +0 -0
- {pyhw-0.13.3 → pyhw-0.14.0}/src/pyhw/backend/nic/__init__.py +0 -0
- {pyhw-0.13.3 → pyhw-0.14.0}/src/pyhw/backend/nic/bsd.py +0 -0
- {pyhw-0.13.3 → pyhw-0.14.0}/src/pyhw/backend/nic/macos.py +0 -0
- {pyhw-0.13.3 → pyhw-0.14.0}/src/pyhw/backend/nic/nicBase.py +0 -0
- {pyhw-0.13.3 → pyhw-0.14.0}/src/pyhw/backend/nic/nicInfo.py +0 -0
- {pyhw-0.13.3 → pyhw-0.14.0}/src/pyhw/backend/npu/__init__.py +0 -0
- {pyhw-0.13.3 → pyhw-0.14.0}/src/pyhw/backend/npu/bsd.py +0 -0
- {pyhw-0.13.3 → pyhw-0.14.0}/src/pyhw/backend/npu/macos.py +0 -0
- {pyhw-0.13.3 → pyhw-0.14.0}/src/pyhw/backend/npu/npuBase.py +0 -0
- {pyhw-0.13.3 → pyhw-0.14.0}/src/pyhw/backend/npu/npuInfo.py +0 -0
- {pyhw-0.13.3 → pyhw-0.14.0}/src/pyhw/backend/os/__init__.py +0 -0
- {pyhw-0.13.3 → pyhw-0.14.0}/src/pyhw/backend/os/bsd.py +0 -0
- {pyhw-0.13.3 → pyhw-0.14.0}/src/pyhw/backend/os/linux.py +0 -0
- {pyhw-0.13.3 → pyhw-0.14.0}/src/pyhw/backend/os/osBase.py +0 -0
- {pyhw-0.13.3 → pyhw-0.14.0}/src/pyhw/backend/os/osInfo.py +0 -0
- {pyhw-0.13.3 → pyhw-0.14.0}/src/pyhw/backend/os/windows.py +0 -0
- {pyhw-0.13.3 → pyhw-0.14.0}/src/pyhw/backend/shell/__init__.py +0 -0
- {pyhw-0.13.3 → pyhw-0.14.0}/src/pyhw/backend/shell/shellBase.py +0 -0
- {pyhw-0.13.3 → pyhw-0.14.0}/src/pyhw/backend/shell/shellInfo.py +0 -0
- {pyhw-0.13.3 → pyhw-0.14.0}/src/pyhw/backend/shell/unix.py +0 -0
- {pyhw-0.13.3 → pyhw-0.14.0}/src/pyhw/backend/shell/windows.py +0 -0
- {pyhw-0.13.3 → pyhw-0.14.0}/src/pyhw/backend/title/__init__.py +0 -0
- {pyhw-0.13.3 → pyhw-0.14.0}/src/pyhw/backend/title/titleBase.py +0 -0
- {pyhw-0.13.3 → pyhw-0.14.0}/src/pyhw/backend/title/titleInfo.py +0 -0
- {pyhw-0.13.3 → pyhw-0.14.0}/src/pyhw/backend/title/unix.py +0 -0
- {pyhw-0.13.3 → pyhw-0.14.0}/src/pyhw/backend/title/windows.py +0 -0
- {pyhw-0.13.3 → pyhw-0.14.0}/src/pyhw/backend/uptime/__init__.py +0 -0
- {pyhw-0.13.3 → pyhw-0.14.0}/src/pyhw/backend/uptime/bsd.py +0 -0
- {pyhw-0.13.3 → pyhw-0.14.0}/src/pyhw/backend/uptime/linux.py +0 -0
- {pyhw-0.13.3 → pyhw-0.14.0}/src/pyhw/backend/uptime/macos.py +0 -0
- {pyhw-0.13.3 → pyhw-0.14.0}/src/pyhw/backend/uptime/uptimeBase.py +0 -0
- {pyhw-0.13.3 → pyhw-0.14.0}/src/pyhw/backend/uptime/uptimeInfo.py +0 -0
- {pyhw-0.13.3 → pyhw-0.14.0}/src/pyhw/backend/uptime/windows.py +0 -0
- {pyhw-0.13.3 → pyhw-0.14.0}/src/pyhw/frontend/__init__.py +0 -0
- {pyhw-0.13.3 → pyhw-0.14.0}/src/pyhw/frontend/color/__init__.py +0 -0
- {pyhw-0.13.3 → pyhw-0.14.0}/src/pyhw/frontend/color/colorConfig.py +0 -0
- {pyhw-0.13.3 → pyhw-0.14.0}/src/pyhw/frontend/color/colorSet.py +0 -0
- {pyhw-0.13.3 → pyhw-0.14.0}/src/pyhw/frontend/color/colorUtil.py +0 -0
- {pyhw-0.13.3 → pyhw-0.14.0}/src/pyhw/frontend/frontendBase.py +0 -0
- {pyhw-0.13.3 → pyhw-0.14.0}/src/pyhw/frontend/logo/__init__.py +0 -0
- {pyhw-0.13.3 → pyhw-0.14.0}/src/pyhw/frontend/logo/ascii/alpine.pyhw +0 -0
- {pyhw-0.13.3 → pyhw-0.14.0}/src/pyhw/frontend/logo/ascii/arch.pyhw +0 -0
- {pyhw-0.13.3 → pyhw-0.14.0}/src/pyhw/frontend/logo/ascii/armbian.pyhw +0 -0
- {pyhw-0.13.3 → pyhw-0.14.0}/src/pyhw/frontend/logo/ascii/centos.pyhw +0 -0
- {pyhw-0.13.3 → pyhw-0.14.0}/src/pyhw/frontend/logo/ascii/debian.pyhw +0 -0
- {pyhw-0.13.3 → pyhw-0.14.0}/src/pyhw/frontend/logo/ascii/fedora.pyhw +0 -0
- {pyhw-0.13.3 → pyhw-0.14.0}/src/pyhw/frontend/logo/ascii/fedora_small.pyhw +0 -0
- {pyhw-0.13.3 → pyhw-0.14.0}/src/pyhw/frontend/logo/ascii/freebsd.pyhw +0 -0
- {pyhw-0.13.3 → pyhw-0.14.0}/src/pyhw/frontend/logo/ascii/kali.pyhw +0 -0
- {pyhw-0.13.3 → pyhw-0.14.0}/src/pyhw/frontend/logo/ascii/linux.pyhw +0 -0
- {pyhw-0.13.3 → pyhw-0.14.0}/src/pyhw/frontend/logo/ascii/linuxmint.pyhw +0 -0
- {pyhw-0.13.3 → pyhw-0.14.0}/src/pyhw/frontend/logo/ascii/macOS.pyhw +0 -0
- {pyhw-0.13.3 → pyhw-0.14.0}/src/pyhw/frontend/logo/ascii/opensuse-leap.pyhw +0 -0
- {pyhw-0.13.3 → pyhw-0.14.0}/src/pyhw/frontend/logo/ascii/opensuse-tumbleweed.pyhw +0 -0
- {pyhw-0.13.3 → pyhw-0.14.0}/src/pyhw/frontend/logo/ascii/raspbian.pyhw +0 -0
- {pyhw-0.13.3 → pyhw-0.14.0}/src/pyhw/frontend/logo/ascii/rhel.pyhw +0 -0
- {pyhw-0.13.3 → pyhw-0.14.0}/src/pyhw/frontend/logo/ascii/ubuntu.pyhw +0 -0
- {pyhw-0.13.3 → pyhw-0.14.0}/src/pyhw/frontend/logo/ascii/ubuntu_small.pyhw +0 -0
- {pyhw-0.13.3 → pyhw-0.14.0}/src/pyhw/frontend/logo/ascii/windows_10.pyhw +0 -0
- {pyhw-0.13.3 → pyhw-0.14.0}/src/pyhw/frontend/logo/ascii/windows_11.pyhw +0 -0
- {pyhw-0.13.3 → pyhw-0.14.0}/src/pyhw/frontend/logo/ascii/windows_2025.pyhw +0 -0
- {pyhw-0.13.3 → pyhw-0.14.0}/src/pyhw/frontend/logo/ascii/windows_old.pyhw +0 -0
- {pyhw-0.13.3 → pyhw-0.14.0}/src/pyhw/frontend/logo/logoBase.py +0 -0
- {pyhw-0.13.3 → pyhw-0.14.0}/src/pyhw/library/lib/iokitCPULib.dylib +0 -0
- {pyhw-0.13.3 → pyhw-0.14.0}/src/pyhw/library/lib/iokitGPULib.dylib +0 -0
- {pyhw-0.13.3 → pyhw-0.14.0}/src/pyhw/library/lib/iokitHostLib.dylib +0 -0
- {pyhw-0.13.3 → pyhw-0.14.0}/src/pyhw/library/lib/nvmlGPULib_amd64.so +0 -0
- {pyhw-0.13.3 → pyhw-0.14.0}/src/pyhw/library/lib/nvmlGPULib_arm64.so +0 -0
- {pyhw-0.13.3 → pyhw-0.14.0}/src/pyhw/library/test/iokitCPULibTest.py +0 -0
- {pyhw-0.13.3 → pyhw-0.14.0}/src/pyhw/library/test/iokitHostLibTest.py +0 -0
- {pyhw-0.13.3 → pyhw-0.14.0}/src/pyhw/library/test/nvmlGPULibTest.py +0 -0
- {pyhw-0.13.3 → pyhw-0.14.0}/src/pyhw/pyhwException/__init__.py +0 -0
- {pyhw-0.13.3 → pyhw-0.14.0}/src/pyhw/pyhwException/pyhwException.py +0 -0
- {pyhw-0.13.3 → pyhw-0.14.0}/src/pyhw/pyhwUtil/pyhwUtil.py +0 -0
- {pyhw-0.13.3 → pyhw-0.14.0}/src/pyhw/pyhwUtil/sysctlUtil.py +0 -0
- {pyhw-0.13.3 → pyhw-0.14.0}/src/pyhw.egg-info/dependency_links.txt +0 -0
- {pyhw-0.13.3 → pyhw-0.14.0}/src/pyhw.egg-info/entry_points.txt +0 -0
- {pyhw-0.13.3 → pyhw-0.14.0}/src/pyhw.egg-info/top_level.txt +0 -0
- {pyhw-0.13.3 → pyhw-0.14.0}/test/test_cliUtil.py +0 -0
@@ -1,6 +1,6 @@
|
|
1
1
|
Metadata-Version: 2.4
|
2
2
|
Name: pyhw
|
3
|
-
Version: 0.
|
3
|
+
Version: 0.14.0
|
4
4
|
Summary: PyHw, a neofetch-like command line tool for fetching system information but written mostly in python.
|
5
5
|
Author: Xiao Ran
|
6
6
|
Maintainer-email: Xiao Ran <xiaoran.007@icloud.com>
|
@@ -13,7 +13,7 @@ Classifier: Operating System :: OS Independent
|
|
13
13
|
Requires-Python: >=3.9
|
14
14
|
Description-Content-Type: text/markdown
|
15
15
|
License-File: LICENSE
|
16
|
-
Requires-Dist: pypci-ng>=0.2.
|
16
|
+
Requires-Dist: pypci-ng>=0.2.6
|
17
17
|
Dynamic: license-file
|
18
18
|
|
19
19
|
# PyHw, a neofetch-like system information fetching tool
|
@@ -4,7 +4,7 @@ build-backend = "setuptools.build_meta"
|
|
4
4
|
|
5
5
|
[project]
|
6
6
|
name = "pyhw"
|
7
|
-
version = "0.
|
7
|
+
version = "0.14.0"
|
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 = [
|
@@ -17,7 +17,7 @@ readme = "README.md"
|
|
17
17
|
license = "BSD-3-Clause"
|
18
18
|
requires-python = ">=3.9"
|
19
19
|
dependencies = [
|
20
|
-
"pypci-ng>=0.2.
|
20
|
+
"pypci-ng>=0.2.6"
|
21
21
|
]
|
22
22
|
classifiers = [
|
23
23
|
"Development Status :: 4 - Beta",
|
@@ -1,2 +1,2 @@
|
|
1
|
-
__version__ = '0.
|
1
|
+
__version__ = '0.14.0'
|
2
2
|
__author__ = 'xiaoran007'
|
@@ -16,6 +16,27 @@ from .pyhwUtil import getOS, selectOSLogo
|
|
16
16
|
from .pyhwUtil import ReleaseChecker
|
17
17
|
from .frontend.color import colorPrefix, colorSuffix, ColorSet
|
18
18
|
import multiprocessing
|
19
|
+
import argparse
|
20
|
+
import time
|
21
|
+
import functools
|
22
|
+
|
23
|
+
|
24
|
+
def timed_function(func):
|
25
|
+
@functools.wraps(func)
|
26
|
+
def wrapper(debug_info, os, result_dict):
|
27
|
+
if not debug_info.get('debug', False):
|
28
|
+
return func(debug_info, os, result_dict)
|
29
|
+
|
30
|
+
start_time = time.time()
|
31
|
+
result = func(debug_info, os, result_dict)
|
32
|
+
elapsed = time.time() - start_time
|
33
|
+
debug_dict = debug_info.get('debug_dict', {})
|
34
|
+
if debug_dict is not None:
|
35
|
+
debug_dict[func.__name__] = elapsed
|
36
|
+
return result
|
37
|
+
|
38
|
+
wrapper.__module__ = func.__module__
|
39
|
+
return wrapper
|
19
40
|
|
20
41
|
|
21
42
|
def check_release(release_dict):
|
@@ -26,57 +47,90 @@ def check_release(release_dict):
|
|
26
47
|
release_dict["is_in_pipx"] = releaseChecker.isInPIPX
|
27
48
|
|
28
49
|
|
29
|
-
|
50
|
+
@timed_function
|
51
|
+
def detect_title(debug_info, os, result_dict):
|
30
52
|
result_dict["title"] = TitleDetect(os=os).getTitle().title
|
31
53
|
|
32
54
|
|
33
|
-
|
55
|
+
@timed_function
|
56
|
+
def detect_host(debug_info, os, result_dict):
|
34
57
|
result_dict["Host"] = HostDetect(os=os).getHostInfo().model
|
35
58
|
|
36
59
|
|
37
|
-
|
60
|
+
@timed_function
|
61
|
+
def detect_kernel(debug_info, os, result_dict):
|
38
62
|
result_dict["Kernel"] = KernelDetect(os=os).getKernelInfo().kernel
|
39
63
|
|
40
64
|
|
41
|
-
|
65
|
+
@timed_function
|
66
|
+
def detect_shell(debug_info, os, result_dict):
|
42
67
|
result_dict["Shell"] = ShellDetect(os=os).getShellInfo().info
|
43
68
|
|
44
69
|
|
45
|
-
|
70
|
+
@timed_function
|
71
|
+
def detect_uptime(debug_info, os, result_dict):
|
46
72
|
result_dict["Uptime"] = UptimeDetect(os=os).getUptime().uptime
|
47
73
|
|
48
74
|
|
49
|
-
|
75
|
+
@timed_function
|
76
|
+
def detect_os(debug_info, os, result_dict):
|
50
77
|
result_dict["OS"] = OSDetect(os=os).getOSInfo().prettyName
|
51
78
|
|
52
79
|
|
53
|
-
|
80
|
+
@timed_function
|
81
|
+
def detect_cpu(debug_info, os, result_dict):
|
54
82
|
result_dict["CPU"] = CPUDetect(os=os).getCPUInfo().cpu
|
55
83
|
|
56
84
|
|
57
|
-
|
85
|
+
@timed_function
|
86
|
+
def detect_gpu(debug_info, os, result_dict):
|
58
87
|
gpu_info = GPUDetect(os=os).getGPUInfo()
|
59
88
|
if gpu_info.number > 0:
|
60
89
|
result_dict["GPU"] = gpu_info.gpus
|
61
90
|
|
62
91
|
|
63
|
-
|
92
|
+
@timed_function
|
93
|
+
def detect_memory(debug_info, os, result_dict):
|
64
94
|
result_dict["Memory"] = MemoryDetect(os=os).getMemoryInfo().memory
|
65
95
|
|
66
96
|
|
67
|
-
|
97
|
+
@timed_function
|
98
|
+
def detect_nic(debug_info, os, result_dict):
|
68
99
|
nic_info = NICDetect(os=os).getNICInfo()
|
69
100
|
if nic_info.number > 0:
|
70
101
|
result_dict["NIC"] = nic_info.nics
|
71
102
|
|
72
103
|
|
73
|
-
|
104
|
+
@timed_function
|
105
|
+
def detect_npu(debug_info, os, result_dict):
|
74
106
|
npu_info = NPUDetect(os=os).getNPUInfo()
|
75
107
|
if npu_info.number > 0:
|
76
108
|
result_dict["NPU"] = npu_info.npus
|
77
109
|
|
78
110
|
|
111
|
+
@timed_function
|
112
|
+
def detect_pci_related(debug_info, os, result_dict):
|
113
|
+
detect_gpu(debug_info, os, result_dict)
|
114
|
+
detect_nic(debug_info, os, result_dict)
|
115
|
+
detect_npu(debug_info, os, result_dict)
|
116
|
+
|
117
|
+
|
118
|
+
def print_version():
|
119
|
+
releaseChecker = ReleaseChecker(only_local=True)
|
120
|
+
print(f"pyhw v{releaseChecker.CurrentVersion}")
|
121
|
+
|
122
|
+
|
79
123
|
def main():
|
124
|
+
parser = argparse.ArgumentParser(description='PyHw, a neofetch-like command line tool for fetching system information')
|
125
|
+
parser.add_argument('-v', '--version', action='store_true', help='Print version information and exit')
|
126
|
+
parser.add_argument('-d', '--debug', action='store_true', help='Run in debug mode')
|
127
|
+
|
128
|
+
args = parser.parse_args()
|
129
|
+
|
130
|
+
if args.version:
|
131
|
+
print_version()
|
132
|
+
return
|
133
|
+
|
80
134
|
current_os = getOS()
|
81
135
|
if current_os not in ["linux", "macos", "freebsd", "windows"]:
|
82
136
|
print(f"Only Linux, macOS, FreeBSD, and Windows are supported for now. Current OS: {current_os}")
|
@@ -87,34 +141,48 @@ def main():
|
|
87
141
|
manager = multiprocessing.Manager()
|
88
142
|
result_dict = manager.dict()
|
89
143
|
release_dict = manager.dict()
|
144
|
+
debug_dict = manager.dict() if args.debug else None
|
145
|
+
debug_info = {'debug': args.debug, 'debug_dict': debug_dict}
|
90
146
|
|
91
147
|
processes = [
|
92
148
|
multiprocessing.Process(target=check_release, args=(release_dict,)),
|
93
|
-
multiprocessing.Process(target=detect_title, args=(current_os, result_dict)),
|
94
|
-
multiprocessing.Process(target=detect_host, args=(current_os, result_dict)),
|
95
|
-
multiprocessing.Process(target=detect_kernel, args=(current_os, result_dict)),
|
96
|
-
multiprocessing.Process(target=detect_shell, args=(current_os, result_dict)),
|
97
|
-
multiprocessing.Process(target=detect_uptime, args=(current_os, result_dict)),
|
98
|
-
multiprocessing.Process(target=detect_os, args=(current_os, result_dict)),
|
99
|
-
multiprocessing.Process(target=detect_cpu, args=(current_os, result_dict)),
|
100
|
-
multiprocessing.Process(target=
|
101
|
-
multiprocessing.Process(target=
|
102
|
-
multiprocessing.Process(target=detect_nic, args=(current_os, result_dict)),
|
103
|
-
multiprocessing.Process(target=detect_npu, args=(current_os, result_dict)),
|
149
|
+
multiprocessing.Process(target=detect_title, args=(debug_info, current_os, result_dict)),
|
150
|
+
multiprocessing.Process(target=detect_host, args=(debug_info, current_os, result_dict)),
|
151
|
+
multiprocessing.Process(target=detect_kernel, args=(debug_info, current_os, result_dict)),
|
152
|
+
multiprocessing.Process(target=detect_shell, args=(debug_info, current_os, result_dict)),
|
153
|
+
multiprocessing.Process(target=detect_uptime, args=(debug_info, current_os, result_dict)),
|
154
|
+
multiprocessing.Process(target=detect_os, args=(debug_info, current_os, result_dict)),
|
155
|
+
multiprocessing.Process(target=detect_cpu, args=(debug_info, current_os, result_dict)),
|
156
|
+
multiprocessing.Process(target=detect_memory, args=(debug_info, current_os, result_dict)),
|
157
|
+
multiprocessing.Process(target=detect_pci_related, args=(debug_info, current_os, result_dict)),
|
104
158
|
]
|
105
159
|
|
160
|
+
start_time = time.time()
|
106
161
|
for process in processes:
|
107
162
|
process.start()
|
108
163
|
|
109
164
|
for process in processes[1:]:
|
110
165
|
process.join()
|
111
166
|
|
167
|
+
total_time = time.time() - start_time
|
168
|
+
|
112
169
|
for key, value in result_dict.items():
|
113
170
|
setattr(data, key, value)
|
114
171
|
|
115
172
|
logo_os = selectOSLogo(OSDetect(os=current_os).getOSInfo().id)
|
116
173
|
Printer(logo_os=logo_os, data=createDataString(data)).cPrint()
|
117
174
|
|
175
|
+
if args.debug:
|
176
|
+
print("\n" + "="*50)
|
177
|
+
print(f"🔍 DEBUG MODE: Timing Information")
|
178
|
+
print("="*50)
|
179
|
+
for func_name, elapsed in debug_dict.items():
|
180
|
+
detection_name = func_name.replace("detect_", "")
|
181
|
+
print(f"{detection_name:<10}: {elapsed:.4f} s")
|
182
|
+
print("-"*50)
|
183
|
+
print(f"Total execution time: {total_time:.4f} s")
|
184
|
+
print("="*50)
|
185
|
+
|
118
186
|
timeout = 3
|
119
187
|
processes[0].join(timeout)
|
120
188
|
if processes[0].is_alive():
|
@@ -1,8 +1,8 @@
|
|
1
1
|
from .gpuInfo import GPUInfo
|
2
2
|
from ..cpu import CPUDetect
|
3
3
|
from ...pyhwUtil import getArch
|
4
|
+
from ...pyhwUtil import PCIManager
|
4
5
|
from pathlib import Path
|
5
|
-
import pypci
|
6
6
|
import ctypes
|
7
7
|
|
8
8
|
|
@@ -17,7 +17,7 @@ class GPUDetectLinux:
|
|
17
17
|
return self.__gpuInfo
|
18
18
|
|
19
19
|
def __getGPUInfo(self):
|
20
|
-
gpu_devices =
|
20
|
+
gpu_devices = PCIManager.get_instance().FindAllVGA()
|
21
21
|
if len(gpu_devices) == 0:
|
22
22
|
self.__handleNonePciDevices()
|
23
23
|
else:
|
@@ -1,5 +1,5 @@
|
|
1
1
|
from .gpuInfo import GPUInfo
|
2
|
-
import
|
2
|
+
from ...pyhwUtil import PCIManager
|
3
3
|
|
4
4
|
|
5
5
|
class GPUDetectWindows:
|
@@ -12,7 +12,7 @@ class GPUDetectWindows:
|
|
12
12
|
return self.__gpuInfo
|
13
13
|
|
14
14
|
def __getGPUInfo(self):
|
15
|
-
gpu_devices =
|
15
|
+
gpu_devices = PCIManager.get_instance().FindAllVGA()
|
16
16
|
if len(gpu_devices) == 0:
|
17
17
|
self.__handleNonePciDevices()
|
18
18
|
else:
|
@@ -1,6 +1,6 @@
|
|
1
1
|
import subprocess
|
2
2
|
from .nicInfo import NICInfo
|
3
|
-
import
|
3
|
+
from ...pyhwUtil import PCIManager
|
4
4
|
import os
|
5
5
|
|
6
6
|
|
@@ -14,7 +14,7 @@ class NICDetectLinux:
|
|
14
14
|
return self._nicInfo
|
15
15
|
|
16
16
|
def _getNICInfo(self):
|
17
|
-
nic_devices =
|
17
|
+
nic_devices = PCIManager.get_instance().FindAllNIC()
|
18
18
|
if len(nic_devices) == 0:
|
19
19
|
self.__handleNonePciDevices()
|
20
20
|
else:
|
@@ -1,5 +1,5 @@
|
|
1
1
|
from .nicInfo import NICInfo
|
2
|
-
import
|
2
|
+
from ...pyhwUtil import PCIManager
|
3
3
|
|
4
4
|
|
5
5
|
class NICDetectWindows:
|
@@ -12,7 +12,7 @@ class NICDetectWindows:
|
|
12
12
|
return self._nicInfo
|
13
13
|
|
14
14
|
def _getNICInfo(self):
|
15
|
-
nic_devices =
|
15
|
+
nic_devices = PCIManager.get_instance().FindAllNIC()
|
16
16
|
if len(nic_devices) == 0:
|
17
17
|
self.__handleNonePciDevices()
|
18
18
|
else:
|
@@ -1,5 +1,5 @@
|
|
1
1
|
from .npuInfo import NPUInfo
|
2
|
-
import
|
2
|
+
from ...pyhwUtil import PCIManager
|
3
3
|
import os
|
4
4
|
|
5
5
|
|
@@ -13,7 +13,7 @@ class NPUDetectLinux:
|
|
13
13
|
return self._npuInfo
|
14
14
|
|
15
15
|
def _getNPUInfo(self):
|
16
|
-
npu_devices =
|
16
|
+
npu_devices = PCIManager.get_instance().FindAllNPU()
|
17
17
|
if len(npu_devices) == 0:
|
18
18
|
self._handleNonePciDevices()
|
19
19
|
else:
|
@@ -1,5 +1,5 @@
|
|
1
1
|
from .npuInfo import NPUInfo
|
2
|
-
import
|
2
|
+
from ...pyhwUtil import PCIManager
|
3
3
|
|
4
4
|
|
5
5
|
class NPUDetectWindows:
|
@@ -12,7 +12,7 @@ class NPUDetectWindows:
|
|
12
12
|
return self._npuInfo
|
13
13
|
|
14
14
|
def _getNPUInfo(self):
|
15
|
-
npu_devices =
|
15
|
+
npu_devices = PCIManager.get_instance().FindAllNPU()
|
16
16
|
if len(npu_devices) == 0:
|
17
17
|
self._handleNonePciDevices()
|
18
18
|
else:
|
@@ -10,14 +10,15 @@ class OSDetectMacOS:
|
|
10
10
|
self.__ProductVersion = ""
|
11
11
|
self.__BuildVersion = ""
|
12
12
|
self.__VersionName = ""
|
13
|
+
self.__Arch = self.__handleOSArch()
|
13
14
|
|
14
15
|
def getOSInfo(self):
|
15
16
|
self.__getOS()
|
16
17
|
self.__handelOSName()
|
17
18
|
if self.__VersionName != "":
|
18
|
-
self.__osInfo.prettyName = f"{self.__ProductName} {self.__VersionName} {self.__ProductVersion} {self.__BuildVersion} {
|
19
|
+
self.__osInfo.prettyName = f"{self.__ProductName} {self.__VersionName} {self.__ProductVersion} {self.__BuildVersion} {self.__Arch}"
|
19
20
|
else:
|
20
|
-
self.__osInfo.prettyName = f"{self.__ProductName} {self.__ProductVersion} {self.__BuildVersion} {
|
21
|
+
self.__osInfo.prettyName = f"{self.__ProductName} {self.__ProductVersion} {self.__BuildVersion} {self.__Arch}"
|
21
22
|
self.__osInfo.id = "macOS"
|
22
23
|
return self.__osInfo
|
23
24
|
|
@@ -51,3 +52,11 @@ class OSDetectMacOS:
|
|
51
52
|
version_name = macOSVersionMap.get(major, "")
|
52
53
|
if version_name != "":
|
53
54
|
self.__VersionName = version_name
|
55
|
+
|
56
|
+
@staticmethod
|
57
|
+
def __handleOSArch():
|
58
|
+
arch = getArch()
|
59
|
+
if arch == "aarch64":
|
60
|
+
return "arm64"
|
61
|
+
else:
|
62
|
+
return arch
|
@@ -0,0 +1,16 @@
|
|
1
|
+
from .pyhwUtil import getOS, getArch, getDocker, getWSL, createDataString, selectOSLogo
|
2
|
+
from .sysctlUtil import sysctlGetString, sysctlGetInt
|
3
|
+
from .cliUtil import ReleaseChecker
|
4
|
+
from .pciUtil import PCIManager
|
5
|
+
|
6
|
+
|
7
|
+
__all__ = ["getOS",
|
8
|
+
"getArch",
|
9
|
+
"getDocker",
|
10
|
+
"getWSL",
|
11
|
+
"createDataString",
|
12
|
+
"selectOSLogo",
|
13
|
+
"sysctlGetString",
|
14
|
+
"sysctlGetInt",
|
15
|
+
"ReleaseChecker",
|
16
|
+
"PCIManager"]
|
@@ -12,13 +12,16 @@ class ReleaseChecker:
|
|
12
12
|
"""
|
13
13
|
PACKAGE_NAME = "pyhw"
|
14
14
|
|
15
|
-
def __init__(self):
|
15
|
+
def __init__(self, only_local=False):
|
16
16
|
"""
|
17
17
|
Initialize the ReleaseChecker.
|
18
18
|
"""
|
19
19
|
self.isInPIPX = self.__is_running_in_pipx()
|
20
20
|
self.CurrentVersion = self.__get_installed_version()
|
21
|
-
|
21
|
+
if only_local:
|
22
|
+
self.LatestVersion = self.CurrentVersion
|
23
|
+
else:
|
24
|
+
self.LatestVersion = self.__get_latest_version()
|
22
25
|
|
23
26
|
@staticmethod
|
24
27
|
def __is_running_in_pipx():
|
@@ -1,6 +1,6 @@
|
|
1
1
|
Metadata-Version: 2.4
|
2
2
|
Name: pyhw
|
3
|
-
Version: 0.
|
3
|
+
Version: 0.14.0
|
4
4
|
Summary: PyHw, a neofetch-like command line tool for fetching system information but written mostly in python.
|
5
5
|
Author: Xiao Ran
|
6
6
|
Maintainer-email: Xiao Ran <xiaoran.007@icloud.com>
|
@@ -13,7 +13,7 @@ Classifier: Operating System :: OS Independent
|
|
13
13
|
Requires-Python: >=3.9
|
14
14
|
Description-Content-Type: text/markdown
|
15
15
|
License-File: LICENSE
|
16
|
-
Requires-Dist: pypci-ng>=0.2.
|
16
|
+
Requires-Dist: pypci-ng>=0.2.6
|
17
17
|
Dynamic: license-file
|
18
18
|
|
19
19
|
# PyHw, a neofetch-like system information fetching tool
|
@@ -124,6 +124,7 @@ src/pyhw/pyhwException/__init__.py
|
|
124
124
|
src/pyhw/pyhwException/pyhwException.py
|
125
125
|
src/pyhw/pyhwUtil/__init__.py
|
126
126
|
src/pyhw/pyhwUtil/cliUtil.py
|
127
|
+
src/pyhw/pyhwUtil/pciUtil.py
|
127
128
|
src/pyhw/pyhwUtil/pyhwUtil.py
|
128
129
|
src/pyhw/pyhwUtil/sysctlUtil.py
|
129
130
|
test/test_cliUtil.py
|
@@ -0,0 +1 @@
|
|
1
|
+
pypci-ng>=0.2.6
|
@@ -1,6 +0,0 @@
|
|
1
|
-
from .pyhwUtil import getOS, getArch, getDocker, getWSL, createDataString, selectOSLogo
|
2
|
-
from .sysctlUtil import sysctlGetString, sysctlGetInt
|
3
|
-
from .cliUtil import ReleaseChecker
|
4
|
-
|
5
|
-
|
6
|
-
__all__ = ["getOS", "getArch", "getDocker", "getWSL", "createDataString", "selectOSLogo", "sysctlGetString", "sysctlGetInt", "ReleaseChecker"]
|
@@ -1 +0,0 @@
|
|
1
|
-
pypci-ng>=0.2.5
|
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
|
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
|