pyhw 0.11.10__py3-none-any.whl → 0.12.1__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/__init__.py +1 -1
- pyhw/backend/cpu/macos.py +8 -6
- pyhw/backend/gpu/macos.py +5 -1
- pyhw/backend/host/macos.py +23 -2
- pyhw/library/lib/iokitGPULib.dylib +0 -0
- pyhw/library/lib/iokitHostLib.dylib +0 -0
- pyhw/library/test/iokitHostLibTest.py +13 -0
- {pyhw-0.11.10.dist-info → pyhw-0.12.1.dist-info}/METADATA +2 -2
- {pyhw-0.11.10.dist-info → pyhw-0.12.1.dist-info}/RECORD +13 -11
- {pyhw-0.11.10.dist-info → pyhw-0.12.1.dist-info}/WHEEL +1 -1
- {pyhw-0.11.10.dist-info → pyhw-0.12.1.dist-info}/LICENSE +0 -0
- {pyhw-0.11.10.dist-info → pyhw-0.12.1.dist-info}/entry_points.txt +0 -0
- {pyhw-0.11.10.dist-info → pyhw-0.12.1.dist-info}/top_level.txt +0 -0
pyhw/__init__.py
CHANGED
@@ -1,2 +1,2 @@
|
|
1
|
-
__version__ = '0.
|
1
|
+
__version__ = '0.12.1'
|
2
2
|
__author__ = 'xiaoran007'
|
pyhw/backend/cpu/macos.py
CHANGED
@@ -52,11 +52,12 @@ class CPUDetectMacOS:
|
|
52
52
|
|
53
53
|
def __AppleSiliconBaseFrequency(self):
|
54
54
|
# see https://en.wikipedia.org/wiki/Apple_silicon#M_series for more details.
|
55
|
+
# https://eclecticlight.co/2025/01/20/what-are-cpu-core-frequencies-in-apple-silicon-macs/
|
55
56
|
freq = {
|
56
|
-
"Apple M1": "
|
57
|
-
"Apple M1 Pro": "
|
58
|
-
"Apple M1 Max": "
|
59
|
-
"Apple M1 Ultra": "
|
57
|
+
"Apple M1": "3.20 GHz",
|
58
|
+
"Apple M1 Pro": "3.23 GHz",
|
59
|
+
"Apple M1 Max": "3.23 GHz",
|
60
|
+
"Apple M1 Ultra": "3.23 GHz",
|
60
61
|
"Apple M2": "3.50 GHz",
|
61
62
|
"Apple M2 Pro": "3.50 GHz",
|
62
63
|
"Apple M2 Max": "3.69 GHz",
|
@@ -64,8 +65,9 @@ class CPUDetectMacOS:
|
|
64
65
|
"Apple M3": "4.05 GHz",
|
65
66
|
"Apple M3 Pro": "4.05 GHz",
|
66
67
|
"Apple M3 Max": "4.05 GHz",
|
68
|
+
"Apple M3 Ultra": "4.05 GHz", # Need more info
|
67
69
|
"Apple M4": "4.40 GHz",
|
68
|
-
"Apple M4 Pro": "4.
|
69
|
-
"Apple M4 Max": "4.
|
70
|
+
"Apple M4 Pro": "4.51 GHz",
|
71
|
+
"Apple M4 Max": "4.51 GHz"
|
70
72
|
}
|
71
73
|
self.__cpuInfo.frequency = freq.get(self.__cpuInfo.model, "Unknown")
|
pyhw/backend/gpu/macos.py
CHANGED
@@ -31,7 +31,7 @@ class GPUDetectMacOS:
|
|
31
31
|
return
|
32
32
|
|
33
33
|
for gpu in gpus:
|
34
|
-
self.__gpuInfo.gpus.append(f'{gpu.get("sppci_model")} ({gpu.get("sppci_cores")}
|
34
|
+
self.__gpuInfo.gpus.append(f'{gpu.get("sppci_model")} ({gpu.get("sppci_cores")} Cores) [SOC Integrated]')
|
35
35
|
|
36
36
|
def __getGPUIntel(self):
|
37
37
|
if self.__getGPUIOKit():
|
@@ -63,6 +63,10 @@ class GPUDetectMacOS:
|
|
63
63
|
lib.getGPUInfo.restype = ctypes.c_char_p
|
64
64
|
gpu_info = lib.getGPUInfo()
|
65
65
|
gpus = gpu_info.decode('utf-8').split("; ")
|
66
|
+
# if the first element is "Error", it means that the library failed to get the GPU info
|
67
|
+
# Fall back to the default implementation
|
68
|
+
if gpus[0] == "Error":
|
69
|
+
return False
|
66
70
|
self.__gpuInfo.number = len(gpus)
|
67
71
|
for gpu in gpus:
|
68
72
|
info_list = gpu.split(", ")
|
pyhw/backend/host/macos.py
CHANGED
@@ -3,6 +3,8 @@
|
|
3
3
|
"""
|
4
4
|
from .hostInfo import HostInfo
|
5
5
|
from ...pyhwUtil import sysctlGetString
|
6
|
+
import ctypes
|
7
|
+
from pathlib import Path
|
6
8
|
|
7
9
|
|
8
10
|
class HostDetectMacOS:
|
@@ -11,10 +13,29 @@ class HostDetectMacOS:
|
|
11
13
|
self.__HWModel = ""
|
12
14
|
|
13
15
|
def getHostInfo(self):
|
14
|
-
self.
|
15
|
-
|
16
|
+
if not self.__getHostInfoIOKit():
|
17
|
+
# if IOKit fails, fallback to sysctl
|
18
|
+
self.__getHWModel()
|
19
|
+
self.__hostInfo.model = self.__handleMacName(self.__HWModel)
|
16
20
|
return self.__hostInfo
|
17
21
|
|
22
|
+
def __getHostInfoIOKit(self):
|
23
|
+
try:
|
24
|
+
package_root = Path(__file__).resolve().parent.parent.parent
|
25
|
+
lib = ctypes.CDLL(f"{package_root}/library/lib/iokitHostLib.dylib")
|
26
|
+
lib.getHostInfo.restype = ctypes.c_char_p
|
27
|
+
host_info = lib.getHostInfo()
|
28
|
+
product_name = host_info.decode('utf-8').split("; ")
|
29
|
+
# If the first element is "Error", it means that the library failed to get the product name.
|
30
|
+
# Fall back to sysctl.
|
31
|
+
if product_name[0] == "Error":
|
32
|
+
return False
|
33
|
+
self.__hostInfo.model = product_name[0]
|
34
|
+
return True
|
35
|
+
except Exception as e:
|
36
|
+
# print(f"An error occurred while getting GPU info using IOKit: {e}")
|
37
|
+
return False
|
38
|
+
|
18
39
|
def __getHWModel(self):
|
19
40
|
self.__HWModel = sysctlGetString("hw.model")
|
20
41
|
|
Binary file
|
Binary file
|
@@ -0,0 +1,13 @@
|
|
1
|
+
import ctypes
|
2
|
+
|
3
|
+
|
4
|
+
def main():
|
5
|
+
lib = ctypes.CDLL(f"../lib/iokitHostLib.dylib")
|
6
|
+
lib.getHostInfo.restype = ctypes.c_char_p
|
7
|
+
host_info = lib.getHostInfo()
|
8
|
+
print(host_info)
|
9
|
+
# gpus = host_info.decode('utf-8').split("; ")
|
10
|
+
|
11
|
+
|
12
|
+
if __name__ == "__main__":
|
13
|
+
main()
|
@@ -1,6 +1,6 @@
|
|
1
1
|
Metadata-Version: 2.2
|
2
2
|
Name: pyhw
|
3
|
-
Version: 0.
|
3
|
+
Version: 0.12.1
|
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>
|
@@ -14,7 +14,7 @@ Classifier: Operating System :: OS Independent
|
|
14
14
|
Requires-Python: >=3.9
|
15
15
|
Description-Content-Type: text/markdown
|
16
16
|
License-File: LICENSE
|
17
|
-
Requires-Dist: pypci-ng>=0.2.
|
17
|
+
Requires-Dist: pypci-ng>=0.2.2
|
18
18
|
|
19
19
|
# PyHw
|
20
20
|
[](https://pepy.tech/project/pyhw)
|
@@ -1,4 +1,4 @@
|
|
1
|
-
pyhw/__init__.py,sha256=
|
1
|
+
pyhw/__init__.py,sha256=7b2iToyIYELNXr7Y8tzbP1ltLj_gLux9vH4rYFqXtfU,49
|
2
2
|
pyhw/__main__.py,sha256=oZpFtvSyYTM8cMsulvi51zJV0gtmw3OCQVdgoaHbtxc,4977
|
3
3
|
pyhw/backend/__init__.py,sha256=knn_3Yroow1h0dqdrozk3zyy3vz-kQyNBRjR6OLmVoY,50
|
4
4
|
pyhw/backend/backendBase.py,sha256=mloo8mPEbgbIdmyQ3I4vdEXMSSjxWi_wnwACmzvHbEo,506
|
@@ -7,21 +7,21 @@ pyhw/backend/cpu/bsd.py,sha256=Ls97NAsvZGVJj3_fBUcYXjY2gsZvFKhXYtkTHxVVXSs,288
|
|
7
7
|
pyhw/backend/cpu/cpuBase.py,sha256=2YAOz1K8VLKtLY7iYBxUV9Ikuf4I4d4YivocvZDrdUU,748
|
8
8
|
pyhw/backend/cpu/cpuInfo.py,sha256=A_nNGElq9W7oZ5DFJowLdFBE0ZvXKr5h29E6TGAvbRc,251
|
9
9
|
pyhw/backend/cpu/linux.py,sha256=TAHTi3hKt9uVyaVS1BP4BtpTHOcmH_6NslnbIAp3afo,3494
|
10
|
-
pyhw/backend/cpu/macos.py,sha256=
|
10
|
+
pyhw/backend/cpu/macos.py,sha256=Mzo-4xBebu-o0p92CYCfdu_k93oLafvs6QExhosywko,3112
|
11
11
|
pyhw/backend/cpu/windows.py,sha256=A3oIvVUVMGPEqiM9QBiK0OwElcEf1LDhNi_23AimooQ,1723
|
12
12
|
pyhw/backend/gpu/__init__.py,sha256=EpMjPvUaXt0LTNMvGmB8WgXbUB9keCxuOhu8NT3Re6o,56
|
13
13
|
pyhw/backend/gpu/bsd.py,sha256=hNFiCek770CXOh3DK3I3-g272-a1S5D7LolGJBsLXaU,124
|
14
14
|
pyhw/backend/gpu/gpuBase.py,sha256=ZPT9o7PhYpzlwign0GsCT519F9DGx-1UEMVVOM8MV_k,748
|
15
15
|
pyhw/backend/gpu/gpuInfo.py,sha256=d_z_z5DiZAg85wP0VOBQEU0QHdaK3qFqA2Tp9Eq8-Zs,133
|
16
16
|
pyhw/backend/gpu/linux.py,sha256=M6pRlu3GREMw1Gm7MA-dY_yYI94MliHW3tyS8JjMw5Q,1617
|
17
|
-
pyhw/backend/gpu/macos.py,sha256=
|
17
|
+
pyhw/backend/gpu/macos.py,sha256=s-GZk_Q7K58nSOYuOIAYLRvLafwHyQtsWrPVe3CuXac,4068
|
18
18
|
pyhw/backend/gpu/windows.py,sha256=Hv-vtWQGKv6_Nxc8raEBq7NNm5TR6xg6x6BK3Aa2uP4,1249
|
19
19
|
pyhw/backend/host/__init__.py,sha256=Efaj7-Oya7H8HdpZHQCLrwn-mcfPb-d6yfh4dzsE_7I,58
|
20
20
|
pyhw/backend/host/bsd.py,sha256=9gKnM6yysHBKwS3EQvb0pCeylh3dzHvoEuPe14zo9wQ,382
|
21
21
|
pyhw/backend/host/hostBase.py,sha256=gM49SY6rEaxec_0bUOMk7QlEfR7vjfWp3BXEUqgdncc,762
|
22
22
|
pyhw/backend/host/hostInfo.py,sha256=grz15M2t3f_enqQvc7Qn6HlEfYwa66bu2NYvm8VpJ-g,452
|
23
23
|
pyhw/backend/host/linux.py,sha256=aU-tWTI2Wjg1HCx2lGFenoaiM94axutXmL7Auu8ilhM,2925
|
24
|
-
pyhw/backend/host/macos.py,sha256=
|
24
|
+
pyhw/backend/host/macos.py,sha256=RgDjvi8RsAs9i-bHkcSdK--TaeyaxYzLXFZFMl8T6Eo,16295
|
25
25
|
pyhw/backend/host/windows.py,sha256=qn2QiTK2wIijyyw_QKdiSizY3teyS-9RNBu5RxEPRSw,1185
|
26
26
|
pyhw/backend/kernel/__init__.py,sha256=fGjwjpOhwA_PnsWbwoq102hwhTay2ufYKaTqxjSV2-I,65
|
27
27
|
pyhw/backend/kernel/kernelBase.py,sha256=3ZmkRkvwoWk3R-by2cgBlZnMSQzVjTC8Owmv53Pm4II,539
|
@@ -104,16 +104,18 @@ pyhw/frontend/logo/ascii/windows_10.pyhw,sha256=jv5pzZs_CdOzpeTjyXfXJWcTQwK-J0LN
|
|
104
104
|
pyhw/frontend/logo/ascii/windows_11.pyhw,sha256=VuQTzbBabaEQhm2JBVhy6Ja6lClUGacQsaiNUih9nhU,656
|
105
105
|
pyhw/frontend/logo/ascii/windows_2025.pyhw,sha256=o8eWsiyhNpDoEjiWFiBMfkd-8MdIslGc1Jpm85LU4P8,643
|
106
106
|
pyhw/frontend/logo/ascii/windows_old.pyhw,sha256=AMsvWAZ50HM8lweWEmzDWbRNDGkKFJo9qLY_VRKrciY,580
|
107
|
-
pyhw/library/lib/iokitGPULib.dylib,sha256=
|
107
|
+
pyhw/library/lib/iokitGPULib.dylib,sha256=1T6nWbzwmDwH4Tu7U2Pka_7ikjIz6xfGBBvC5ejv0SQ,154552
|
108
|
+
pyhw/library/lib/iokitHostLib.dylib,sha256=0sdPRA-dtogsgPEgb-VN32on6oIJMT9PmRZ0whRpQE0,149256
|
109
|
+
pyhw/library/test/iokitHostLibTest.py,sha256=oz5x1g4WMdoikU3Eo6zoxcHZ4e-UMRhXg0C0Lflo-ac,272
|
108
110
|
pyhw/pyhwException/__init__.py,sha256=8JsFvtF13g0Y5t4z9fRndDXtfCzuBM59jDf6PhWSFSk,220
|
109
111
|
pyhw/pyhwException/pyhwException.py,sha256=wxuzFQa9g7XB1q9TUKO_55lw7wMEJMpzG8w1GVTFVa0,197
|
110
112
|
pyhw/pyhwUtil/__init__.py,sha256=34ygvVBBqfJ_9OMzHToCcV_BVahixNsa_Z5yh6VsaPQ,304
|
111
113
|
pyhw/pyhwUtil/cliUtil.py,sha256=42Gdi9wTg5XOYuEvGHEgOaZJ6dJk1qSuHIprR8pCA-g,2344
|
112
114
|
pyhw/pyhwUtil/pyhwUtil.py,sha256=RokrE7X99pkS0LtN4wyJS_ZQmjtMwiNxA7MwXMoO96c,7664
|
113
115
|
pyhw/pyhwUtil/sysctlUtil.py,sha256=S-rUvqi7ZrMyMouIhxlyHEQ4agM7sCT1Y7uzs3Hu5-o,841
|
114
|
-
pyhw-0.
|
115
|
-
pyhw-0.
|
116
|
-
pyhw-0.
|
117
|
-
pyhw-0.
|
118
|
-
pyhw-0.
|
119
|
-
pyhw-0.
|
116
|
+
pyhw-0.12.1.dist-info/LICENSE,sha256=hJs6RBqSVCexbTsalkMLNFI5t06kekQEsSVaOt_-yLs,1497
|
117
|
+
pyhw-0.12.1.dist-info/METADATA,sha256=ST9mK338vzRH0CI9mX31UerZPsGYiIYSN9tkYKNe2ww,6753
|
118
|
+
pyhw-0.12.1.dist-info/WHEEL,sha256=beeZ86-EfXScwlR_HKu4SllMC9wUEj_8Z_4FJ3egI2w,91
|
119
|
+
pyhw-0.12.1.dist-info/entry_points.txt,sha256=q-AB8im_QahpmNrmy4aPTJRGi0LlbNlnI3kF7s6pKss,44
|
120
|
+
pyhw-0.12.1.dist-info/top_level.txt,sha256=7Inxvxt1TngEricKZEex9_WJZS3DbKYFUXDz4v5WHYU,5
|
121
|
+
pyhw-0.12.1.dist-info/RECORD,,
|
File without changes
|
File without changes
|
File without changes
|