pyhw 0.3.7__py3-none-any.whl → 0.4.0__py3-none-any.whl
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/backend/gpu/linux.py +10 -11
- pyhw/backend/nic/linux.py +11 -13
- pyhw/backend/nic/macos.py +7 -0
- {pyhw-0.3.7.dist-info → pyhw-0.4.0.dist-info}/METADATA +5 -2
- {pyhw-0.3.7.dist-info → pyhw-0.4.0.dist-info}/RECORD +9 -9
- {pyhw-0.3.7.dist-info → pyhw-0.4.0.dist-info}/WHEEL +1 -1
- {pyhw-0.3.7.dist-info → pyhw-0.4.0.dist-info}/LICENSE +0 -0
- {pyhw-0.3.7.dist-info → pyhw-0.4.0.dist-info}/entry_points.txt +0 -0
- {pyhw-0.3.7.dist-info → pyhw-0.4.0.dist-info}/top_level.txt +0 -0
pyhw/backend/gpu/linux.py
CHANGED
@@ -2,6 +2,7 @@ import subprocess
|
|
2
2
|
from .gpuInfo import GPUInfo
|
3
3
|
from ..cpu import CPUDetect
|
4
4
|
from ...pyhwUtil import getArch
|
5
|
+
import pypci
|
5
6
|
|
6
7
|
|
7
8
|
class GPUDetectLinux:
|
@@ -14,19 +15,17 @@ class GPUDetectLinux:
|
|
14
15
|
return self.__gpuInfo
|
15
16
|
|
16
17
|
def __getGPUInfo(self):
|
17
|
-
|
18
|
-
|
19
|
-
except subprocess.SubprocessError:
|
20
|
-
return
|
21
|
-
if len(pci_info) == 0: # no pcie devices found
|
18
|
+
gpu_devices = pypci.PCI().FindAllVGA()
|
19
|
+
if len(gpu_devices) == 0:
|
22
20
|
self.__handleNonePciDevices()
|
23
|
-
|
24
|
-
|
25
|
-
|
26
|
-
|
21
|
+
else:
|
22
|
+
for device in gpu_devices:
|
23
|
+
if device.subsystem_device_name != "":
|
24
|
+
device_name = f"{device.vendor_name} {device.device_name} ({device.subsystem_device_name})"
|
25
|
+
else:
|
26
|
+
device_name = f"{device.vendor_name} {device.device_name}"
|
27
|
+
self.__gpuInfo.gpus.append(self.__gpuNameClean(device_name))
|
27
28
|
self.__gpuInfo.number += 1
|
28
|
-
if self.__gpuInfo.number == 0:
|
29
|
-
self.__handleNonePciDevices() # fallback to a sbc device detection method
|
30
29
|
|
31
30
|
def __handleNonePciDevices(self):
|
32
31
|
# if detector can't find any VGA/Display/3D GPUs, assume the host is a sbc device, this function is a placeholder for a more advanced method.
|
pyhw/backend/nic/linux.py
CHANGED
@@ -2,6 +2,7 @@ import subprocess
|
|
2
2
|
from .nicInfo import NICInfo
|
3
3
|
from ...pyhwUtil import getArch
|
4
4
|
from ...pyhwException import BackendException
|
5
|
+
import pypci
|
5
6
|
|
6
7
|
|
7
8
|
class NICDetectLinux:
|
@@ -14,20 +15,17 @@ class NICDetectLinux:
|
|
14
15
|
return self.__nicInfo
|
15
16
|
|
16
17
|
def __getNICInfo(self):
|
17
|
-
|
18
|
-
|
19
|
-
except subprocess.SubprocessError:
|
20
|
-
return
|
21
|
-
if len(pci_info) == 0: # no pcie devices found
|
18
|
+
nic_devices = pypci.PCI().FindAllNIC()
|
19
|
+
if len(nic_devices) == 0:
|
22
20
|
self.__handleNonePciDevices()
|
23
|
-
|
24
|
-
|
25
|
-
|
26
|
-
|
27
|
-
|
21
|
+
else:
|
22
|
+
for device in nic_devices:
|
23
|
+
if device.subsystem_device_name != "":
|
24
|
+
device_name = f"{device.vendor_name} {device.device_name} ({device.subsystem_device_name})"
|
25
|
+
else:
|
26
|
+
device_name = f"{device.vendor_name} {device.device_name}"
|
27
|
+
self.__nicInfo.nics.append(self.__nicNameClean(device_name))
|
28
28
|
self.__nicInfo.number += 1
|
29
|
-
if self.__nicInfo.number == 0:
|
30
|
-
self.__handleNonePciDevices() # fallback to usb detection method
|
31
29
|
|
32
30
|
def __handleNonePciDevices(self):
|
33
31
|
# placeholder for a more advanced method.
|
@@ -40,4 +38,4 @@ class NICDetectLinux:
|
|
40
38
|
return nic_name_clean
|
41
39
|
|
42
40
|
def __sortNICList(self):
|
43
|
-
return self.__nicInfo.nics.sort()
|
41
|
+
return self.__nicInfo.nics.sort()
|
pyhw/backend/nic/macos.py
CHANGED
@@ -1,4 +1,5 @@
|
|
1
1
|
from .nicInfo import NICInfo
|
2
|
+
import subprocess
|
2
3
|
|
3
4
|
|
4
5
|
class NICDetectMacOS:
|
@@ -9,3 +10,9 @@ class NICDetectMacOS:
|
|
9
10
|
self.__nicInfo.nics.append("en0")
|
10
11
|
self.__nicInfo.number = 1
|
11
12
|
return self.__nicInfo
|
13
|
+
|
14
|
+
def __getNICInfo(self):
|
15
|
+
# Placeholder for a more advanced method.
|
16
|
+
interfaces = subprocess.run(["bash", "-c", "route get default | grep interface"], capture_output=True, text=True).stdout.strip()
|
17
|
+
|
18
|
+
|
@@ -1,6 +1,6 @@
|
|
1
1
|
Metadata-Version: 2.1
|
2
2
|
Name: pyhw
|
3
|
-
Version: 0.
|
3
|
+
Version: 0.4.0
|
4
4
|
Summary: PyHw, a neofetch-like command line tool for fetching system information but written mostly in python.
|
5
5
|
Author-email: Xiao Ran <xiaoran.007@icloud.com>
|
6
6
|
License: BSD-3-Clause
|
@@ -13,6 +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.0.1
|
16
17
|
|
17
18
|
# PyHw
|
18
19
|
[](https://pepy.tech/project/pyhw)
|
@@ -27,7 +28,9 @@ PyHw, a neofetch-like command line tool for fetching system information but writ
|
|
27
28
|
This project is a Python reimplementation of [neofetch](https://github.com/dylanaraps/neofetch) and references the [fastfetch](https://github.com/fastfetch-cli/fastfetch) project for logo style settings. Since this project is implemented in Python, it will be easier to maintain and extend than bash and c implementation. Also, this project only relies on the Python standard library, so you can run it on any device that has a Python environment (I hope so 🤔).
|
28
29
|
|
29
30
|
|
30
|
-
![demo]
|
31
|
+
[//]: # ()
|
32
|
+

|
33
|
+
|
31
34
|
|
32
35
|
|
33
36
|
|
@@ -11,7 +11,7 @@ pyhw/backend/cpu/macos.py,sha256=mnnH9ABiBgAiyA8-H9_tq2PC5OeneVLj67nMGoLDXh4,287
|
|
11
11
|
pyhw/backend/gpu/__init__.py,sha256=EpMjPvUaXt0LTNMvGmB8WgXbUB9keCxuOhu8NT3Re6o,56
|
12
12
|
pyhw/backend/gpu/gpuBase.py,sha256=Ge0DX2P8_EB7ovM7glmPUnVsPJL3OUHV2t_1T5mimR0,409
|
13
13
|
pyhw/backend/gpu/gpuInfo.py,sha256=d_z_z5DiZAg85wP0VOBQEU0QHdaK3qFqA2Tp9Eq8-Zs,133
|
14
|
-
pyhw/backend/gpu/linux.py,sha256=
|
14
|
+
pyhw/backend/gpu/linux.py,sha256=E-evoL-spQbHB8JvbZXSq5ypc2SeePVUPnhEQrSPQpg,1619
|
15
15
|
pyhw/backend/gpu/macos.py,sha256=kkTq9_ZJwTQ0Jwep4oYq41STDTplFz83jKRYbvlbMhg,2337
|
16
16
|
pyhw/backend/host/__init__.py,sha256=Efaj7-Oya7H8HdpZHQCLrwn-mcfPb-d6yfh4dzsE_7I,58
|
17
17
|
pyhw/backend/host/hostBase.py,sha256=POyDW3f5JSWtEKyCfrVSBEddSwoywe_OBgUExCEuje8,563
|
@@ -31,8 +31,8 @@ pyhw/backend/memory/memoryBase.py,sha256=RFRWTByH25T3T77maxLyIRRoedIi5M8XLtVbvwB
|
|
31
31
|
pyhw/backend/memory/memoryInfo.py,sha256=OQF165uEyuapAsi7cKacQYDRnKdrQHeldfyFwzS9N2g,186
|
32
32
|
pyhw/backend/metal/t.py,sha256=52yv-JoXNfaIOfcxEEidIg0MoyFtzWvTRm550kQKPZA,391
|
33
33
|
pyhw/backend/nic/__init__.py,sha256=eP4eOYIvMF3LcTf954hJa6TnB8R4Qahss2g-UcgypKY,57
|
34
|
-
pyhw/backend/nic/linux.py,sha256=
|
35
|
-
pyhw/backend/nic/macos.py,sha256=
|
34
|
+
pyhw/backend/nic/linux.py,sha256=2IDhesM77qLt7QK8HzYiMeLyuKWOVVrrDtkLHs7R6lU,1321
|
35
|
+
pyhw/backend/nic/macos.py,sha256=Gi-XAf2ZvJcWbwJvTlkpdyKaRDSXXiI2WhISeASxbvc,481
|
36
36
|
pyhw/backend/nic/nicBase.py,sha256=hmVbiPOrDFClQrOBgAUgE8GVkC5nVH280jnlb65CDV4,539
|
37
37
|
pyhw/backend/nic/nicInfo.py,sha256=wuBuL-aIzD441IUDPGz5e0xctcZ-opdpgqkVxgbvZLg,133
|
38
38
|
pyhw/backend/os/__init__.py,sha256=rPHQYdQK3qU6ZwwodqVoEWeqBnKffXlJyi4k3-8ViPY,53
|
@@ -77,9 +77,9 @@ pyhw/pyhwException/pyhwException.py,sha256=wxuzFQa9g7XB1q9TUKO_55lw7wMEJMpzG8w1G
|
|
77
77
|
pyhw/pyhwUtil/__init__.py,sha256=PzeP9fXsIhvr3sUpJ4DxW9_H25DEIasBFfXd_NztfR4,226
|
78
78
|
pyhw/pyhwUtil/pyhwUtil.py,sha256=PXibpl4hfc-xFHV1HNWwkzttC0NQITHLEwojYKMmD-U,2413
|
79
79
|
pyhw/pyhwUtil/sysctlUtil.py,sha256=S-rUvqi7ZrMyMouIhxlyHEQ4agM7sCT1Y7uzs3Hu5-o,841
|
80
|
-
pyhw-0.
|
81
|
-
pyhw-0.
|
82
|
-
pyhw-0.
|
83
|
-
pyhw-0.
|
84
|
-
pyhw-0.
|
85
|
-
pyhw-0.
|
80
|
+
pyhw-0.4.0.dist-info/LICENSE,sha256=hJs6RBqSVCexbTsalkMLNFI5t06kekQEsSVaOt_-yLs,1497
|
81
|
+
pyhw-0.4.0.dist-info/METADATA,sha256=s9V56kt4Wf7VbhDWvGAfI0RPE0rLSzLAXpTp4H4lpqI,4136
|
82
|
+
pyhw-0.4.0.dist-info/WHEEL,sha256=GV9aMThwP_4oNCtvEC2ec3qUYutgWeAzklro_0m4WJQ,91
|
83
|
+
pyhw-0.4.0.dist-info/entry_points.txt,sha256=q-AB8im_QahpmNrmy4aPTJRGi0LlbNlnI3kF7s6pKss,44
|
84
|
+
pyhw-0.4.0.dist-info/top_level.txt,sha256=7Inxvxt1TngEricKZEex9_WJZS3DbKYFUXDz4v5WHYU,5
|
85
|
+
pyhw-0.4.0.dist-info/RECORD,,
|
File without changes
|
File without changes
|
File without changes
|