pyhw 0.13.2__tar.gz → 0.13.4__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.
Files changed (133) hide show
  1. {pyhw-0.13.2/src/pyhw.egg-info → pyhw-0.13.4}/PKG-INFO +4 -2
  2. {pyhw-0.13.2 → pyhw-0.13.4}/README.md +2 -0
  3. {pyhw-0.13.2 → pyhw-0.13.4}/pyproject.toml +2 -2
  4. {pyhw-0.13.2 → pyhw-0.13.4}/src/pyhw/__init__.py +1 -1
  5. {pyhw-0.13.2 → pyhw-0.13.4}/src/pyhw/__main__.py +15 -0
  6. {pyhw-0.13.2 → pyhw-0.13.4}/src/pyhw/backend/cpu/linux.py +14 -1
  7. {pyhw-0.13.2 → pyhw-0.13.4}/src/pyhw/backend/cpu/macos.py +21 -2
  8. {pyhw-0.13.2 → pyhw-0.13.4}/src/pyhw/backend/gpu/linux.py +4 -0
  9. {pyhw-0.13.2 → pyhw-0.13.4}/src/pyhw/backend/host/linux.py +1 -1
  10. {pyhw-0.13.2 → pyhw-0.13.4}/src/pyhw/backend/os/macos.py +11 -2
  11. pyhw-0.13.4/src/pyhw/library/lib/iokitCPULib.dylib +0 -0
  12. pyhw-0.13.4/src/pyhw/library/test/iokitCPULibTest.py +15 -0
  13. {pyhw-0.13.2 → pyhw-0.13.4}/src/pyhw/pyhwUtil/pyhwUtil.py +8 -6
  14. {pyhw-0.13.2 → pyhw-0.13.4/src/pyhw.egg-info}/PKG-INFO +4 -2
  15. {pyhw-0.13.2 → pyhw-0.13.4}/src/pyhw.egg-info/SOURCES.txt +1 -0
  16. pyhw-0.13.4/src/pyhw.egg-info/requires.txt +1 -0
  17. pyhw-0.13.2/src/pyhw/library/lib/iokitCPULib.dylib +0 -0
  18. pyhw-0.13.2/src/pyhw.egg-info/requires.txt +0 -1
  19. {pyhw-0.13.2 → pyhw-0.13.4}/LICENSE +0 -0
  20. {pyhw-0.13.2 → pyhw-0.13.4}/setup.cfg +0 -0
  21. {pyhw-0.13.2 → pyhw-0.13.4}/src/pyhw/backend/__init__.py +0 -0
  22. {pyhw-0.13.2 → pyhw-0.13.4}/src/pyhw/backend/backendBase.py +0 -0
  23. {pyhw-0.13.2 → pyhw-0.13.4}/src/pyhw/backend/cpu/__init__.py +0 -0
  24. {pyhw-0.13.2 → pyhw-0.13.4}/src/pyhw/backend/cpu/bsd.py +0 -0
  25. {pyhw-0.13.2 → pyhw-0.13.4}/src/pyhw/backend/cpu/cpuBase.py +0 -0
  26. {pyhw-0.13.2 → pyhw-0.13.4}/src/pyhw/backend/cpu/cpuInfo.py +0 -0
  27. {pyhw-0.13.2 → pyhw-0.13.4}/src/pyhw/backend/cpu/windows.py +0 -0
  28. {pyhw-0.13.2 → pyhw-0.13.4}/src/pyhw/backend/gpu/__init__.py +0 -0
  29. {pyhw-0.13.2 → pyhw-0.13.4}/src/pyhw/backend/gpu/bsd.py +0 -0
  30. {pyhw-0.13.2 → pyhw-0.13.4}/src/pyhw/backend/gpu/gpuBase.py +0 -0
  31. {pyhw-0.13.2 → pyhw-0.13.4}/src/pyhw/backend/gpu/gpuInfo.py +0 -0
  32. {pyhw-0.13.2 → pyhw-0.13.4}/src/pyhw/backend/gpu/macos.py +0 -0
  33. {pyhw-0.13.2 → pyhw-0.13.4}/src/pyhw/backend/gpu/windows.py +0 -0
  34. {pyhw-0.13.2 → pyhw-0.13.4}/src/pyhw/backend/host/__init__.py +0 -0
  35. {pyhw-0.13.2 → pyhw-0.13.4}/src/pyhw/backend/host/bsd.py +0 -0
  36. {pyhw-0.13.2 → pyhw-0.13.4}/src/pyhw/backend/host/hostBase.py +0 -0
  37. {pyhw-0.13.2 → pyhw-0.13.4}/src/pyhw/backend/host/hostInfo.py +0 -0
  38. {pyhw-0.13.2 → pyhw-0.13.4}/src/pyhw/backend/host/macos.py +0 -0
  39. {pyhw-0.13.2 → pyhw-0.13.4}/src/pyhw/backend/host/windows.py +0 -0
  40. {pyhw-0.13.2 → pyhw-0.13.4}/src/pyhw/backend/kernel/__init__.py +0 -0
  41. {pyhw-0.13.2 → pyhw-0.13.4}/src/pyhw/backend/kernel/kernelBase.py +0 -0
  42. {pyhw-0.13.2 → pyhw-0.13.4}/src/pyhw/backend/kernel/kernelInfo.py +0 -0
  43. {pyhw-0.13.2 → pyhw-0.13.4}/src/pyhw/backend/kernel/unix.py +0 -0
  44. {pyhw-0.13.2 → pyhw-0.13.4}/src/pyhw/backend/kernel/windows.py +0 -0
  45. {pyhw-0.13.2 → pyhw-0.13.4}/src/pyhw/backend/memory/__init__.py +0 -0
  46. {pyhw-0.13.2 → pyhw-0.13.4}/src/pyhw/backend/memory/bsd.py +0 -0
  47. {pyhw-0.13.2 → pyhw-0.13.4}/src/pyhw/backend/memory/linux.py +0 -0
  48. {pyhw-0.13.2 → pyhw-0.13.4}/src/pyhw/backend/memory/macos.py +0 -0
  49. {pyhw-0.13.2 → pyhw-0.13.4}/src/pyhw/backend/memory/memoryBase.py +0 -0
  50. {pyhw-0.13.2 → pyhw-0.13.4}/src/pyhw/backend/memory/memoryInfo.py +0 -0
  51. {pyhw-0.13.2 → pyhw-0.13.4}/src/pyhw/backend/memory/windows.py +0 -0
  52. {pyhw-0.13.2 → pyhw-0.13.4}/src/pyhw/backend/nic/__init__.py +0 -0
  53. {pyhw-0.13.2 → pyhw-0.13.4}/src/pyhw/backend/nic/bsd.py +0 -0
  54. {pyhw-0.13.2 → pyhw-0.13.4}/src/pyhw/backend/nic/linux.py +0 -0
  55. {pyhw-0.13.2 → pyhw-0.13.4}/src/pyhw/backend/nic/macos.py +0 -0
  56. {pyhw-0.13.2 → pyhw-0.13.4}/src/pyhw/backend/nic/nicBase.py +0 -0
  57. {pyhw-0.13.2 → pyhw-0.13.4}/src/pyhw/backend/nic/nicInfo.py +0 -0
  58. {pyhw-0.13.2 → pyhw-0.13.4}/src/pyhw/backend/nic/windows.py +0 -0
  59. {pyhw-0.13.2 → pyhw-0.13.4}/src/pyhw/backend/npu/__init__.py +0 -0
  60. {pyhw-0.13.2 → pyhw-0.13.4}/src/pyhw/backend/npu/bsd.py +0 -0
  61. {pyhw-0.13.2 → pyhw-0.13.4}/src/pyhw/backend/npu/linux.py +0 -0
  62. {pyhw-0.13.2 → pyhw-0.13.4}/src/pyhw/backend/npu/macos.py +0 -0
  63. {pyhw-0.13.2 → pyhw-0.13.4}/src/pyhw/backend/npu/npuBase.py +0 -0
  64. {pyhw-0.13.2 → pyhw-0.13.4}/src/pyhw/backend/npu/npuInfo.py +0 -0
  65. {pyhw-0.13.2 → pyhw-0.13.4}/src/pyhw/backend/npu/windows.py +0 -0
  66. {pyhw-0.13.2 → pyhw-0.13.4}/src/pyhw/backend/os/__init__.py +0 -0
  67. {pyhw-0.13.2 → pyhw-0.13.4}/src/pyhw/backend/os/bsd.py +0 -0
  68. {pyhw-0.13.2 → pyhw-0.13.4}/src/pyhw/backend/os/linux.py +0 -0
  69. {pyhw-0.13.2 → pyhw-0.13.4}/src/pyhw/backend/os/osBase.py +0 -0
  70. {pyhw-0.13.2 → pyhw-0.13.4}/src/pyhw/backend/os/osInfo.py +0 -0
  71. {pyhw-0.13.2 → pyhw-0.13.4}/src/pyhw/backend/os/windows.py +0 -0
  72. {pyhw-0.13.2 → pyhw-0.13.4}/src/pyhw/backend/shell/__init__.py +0 -0
  73. {pyhw-0.13.2 → pyhw-0.13.4}/src/pyhw/backend/shell/shellBase.py +0 -0
  74. {pyhw-0.13.2 → pyhw-0.13.4}/src/pyhw/backend/shell/shellInfo.py +0 -0
  75. {pyhw-0.13.2 → pyhw-0.13.4}/src/pyhw/backend/shell/unix.py +0 -0
  76. {pyhw-0.13.2 → pyhw-0.13.4}/src/pyhw/backend/shell/windows.py +0 -0
  77. {pyhw-0.13.2 → pyhw-0.13.4}/src/pyhw/backend/title/__init__.py +0 -0
  78. {pyhw-0.13.2 → pyhw-0.13.4}/src/pyhw/backend/title/titleBase.py +0 -0
  79. {pyhw-0.13.2 → pyhw-0.13.4}/src/pyhw/backend/title/titleInfo.py +0 -0
  80. {pyhw-0.13.2 → pyhw-0.13.4}/src/pyhw/backend/title/unix.py +0 -0
  81. {pyhw-0.13.2 → pyhw-0.13.4}/src/pyhw/backend/title/windows.py +0 -0
  82. {pyhw-0.13.2 → pyhw-0.13.4}/src/pyhw/backend/uptime/__init__.py +0 -0
  83. {pyhw-0.13.2 → pyhw-0.13.4}/src/pyhw/backend/uptime/bsd.py +0 -0
  84. {pyhw-0.13.2 → pyhw-0.13.4}/src/pyhw/backend/uptime/linux.py +0 -0
  85. {pyhw-0.13.2 → pyhw-0.13.4}/src/pyhw/backend/uptime/macos.py +0 -0
  86. {pyhw-0.13.2 → pyhw-0.13.4}/src/pyhw/backend/uptime/uptimeBase.py +0 -0
  87. {pyhw-0.13.2 → pyhw-0.13.4}/src/pyhw/backend/uptime/uptimeInfo.py +0 -0
  88. {pyhw-0.13.2 → pyhw-0.13.4}/src/pyhw/backend/uptime/windows.py +0 -0
  89. {pyhw-0.13.2 → pyhw-0.13.4}/src/pyhw/frontend/__init__.py +0 -0
  90. {pyhw-0.13.2 → pyhw-0.13.4}/src/pyhw/frontend/color/__init__.py +0 -0
  91. {pyhw-0.13.2 → pyhw-0.13.4}/src/pyhw/frontend/color/colorConfig.py +0 -0
  92. {pyhw-0.13.2 → pyhw-0.13.4}/src/pyhw/frontend/color/colorSet.py +0 -0
  93. {pyhw-0.13.2 → pyhw-0.13.4}/src/pyhw/frontend/color/colorUtil.py +0 -0
  94. {pyhw-0.13.2 → pyhw-0.13.4}/src/pyhw/frontend/frontendBase.py +0 -0
  95. {pyhw-0.13.2 → pyhw-0.13.4}/src/pyhw/frontend/logo/__init__.py +0 -0
  96. {pyhw-0.13.2 → pyhw-0.13.4}/src/pyhw/frontend/logo/ascii/alpine.pyhw +0 -0
  97. {pyhw-0.13.2 → pyhw-0.13.4}/src/pyhw/frontend/logo/ascii/arch.pyhw +0 -0
  98. {pyhw-0.13.2 → pyhw-0.13.4}/src/pyhw/frontend/logo/ascii/armbian.pyhw +0 -0
  99. {pyhw-0.13.2 → pyhw-0.13.4}/src/pyhw/frontend/logo/ascii/centos.pyhw +0 -0
  100. {pyhw-0.13.2 → pyhw-0.13.4}/src/pyhw/frontend/logo/ascii/debian.pyhw +0 -0
  101. {pyhw-0.13.2 → pyhw-0.13.4}/src/pyhw/frontend/logo/ascii/fedora.pyhw +0 -0
  102. {pyhw-0.13.2 → pyhw-0.13.4}/src/pyhw/frontend/logo/ascii/fedora_small.pyhw +0 -0
  103. {pyhw-0.13.2 → pyhw-0.13.4}/src/pyhw/frontend/logo/ascii/freebsd.pyhw +0 -0
  104. {pyhw-0.13.2 → pyhw-0.13.4}/src/pyhw/frontend/logo/ascii/kali.pyhw +0 -0
  105. {pyhw-0.13.2 → pyhw-0.13.4}/src/pyhw/frontend/logo/ascii/linux.pyhw +0 -0
  106. {pyhw-0.13.2 → pyhw-0.13.4}/src/pyhw/frontend/logo/ascii/linuxmint.pyhw +0 -0
  107. {pyhw-0.13.2 → pyhw-0.13.4}/src/pyhw/frontend/logo/ascii/macOS.pyhw +0 -0
  108. {pyhw-0.13.2 → pyhw-0.13.4}/src/pyhw/frontend/logo/ascii/opensuse-leap.pyhw +0 -0
  109. {pyhw-0.13.2 → pyhw-0.13.4}/src/pyhw/frontend/logo/ascii/opensuse-tumbleweed.pyhw +0 -0
  110. {pyhw-0.13.2 → pyhw-0.13.4}/src/pyhw/frontend/logo/ascii/raspbian.pyhw +0 -0
  111. {pyhw-0.13.2 → pyhw-0.13.4}/src/pyhw/frontend/logo/ascii/rhel.pyhw +0 -0
  112. {pyhw-0.13.2 → pyhw-0.13.4}/src/pyhw/frontend/logo/ascii/ubuntu.pyhw +0 -0
  113. {pyhw-0.13.2 → pyhw-0.13.4}/src/pyhw/frontend/logo/ascii/ubuntu_small.pyhw +0 -0
  114. {pyhw-0.13.2 → pyhw-0.13.4}/src/pyhw/frontend/logo/ascii/windows_10.pyhw +0 -0
  115. {pyhw-0.13.2 → pyhw-0.13.4}/src/pyhw/frontend/logo/ascii/windows_11.pyhw +0 -0
  116. {pyhw-0.13.2 → pyhw-0.13.4}/src/pyhw/frontend/logo/ascii/windows_2025.pyhw +0 -0
  117. {pyhw-0.13.2 → pyhw-0.13.4}/src/pyhw/frontend/logo/ascii/windows_old.pyhw +0 -0
  118. {pyhw-0.13.2 → pyhw-0.13.4}/src/pyhw/frontend/logo/logoBase.py +0 -0
  119. {pyhw-0.13.2 → pyhw-0.13.4}/src/pyhw/library/lib/iokitGPULib.dylib +0 -0
  120. {pyhw-0.13.2 → pyhw-0.13.4}/src/pyhw/library/lib/iokitHostLib.dylib +0 -0
  121. {pyhw-0.13.2 → pyhw-0.13.4}/src/pyhw/library/lib/nvmlGPULib_amd64.so +0 -0
  122. {pyhw-0.13.2 → pyhw-0.13.4}/src/pyhw/library/lib/nvmlGPULib_arm64.so +0 -0
  123. {pyhw-0.13.2 → pyhw-0.13.4}/src/pyhw/library/test/iokitHostLibTest.py +0 -0
  124. {pyhw-0.13.2 → pyhw-0.13.4}/src/pyhw/library/test/nvmlGPULibTest.py +0 -0
  125. {pyhw-0.13.2 → pyhw-0.13.4}/src/pyhw/pyhwException/__init__.py +0 -0
  126. {pyhw-0.13.2 → pyhw-0.13.4}/src/pyhw/pyhwException/pyhwException.py +0 -0
  127. {pyhw-0.13.2 → pyhw-0.13.4}/src/pyhw/pyhwUtil/__init__.py +0 -0
  128. {pyhw-0.13.2 → pyhw-0.13.4}/src/pyhw/pyhwUtil/cliUtil.py +0 -0
  129. {pyhw-0.13.2 → pyhw-0.13.4}/src/pyhw/pyhwUtil/sysctlUtil.py +0 -0
  130. {pyhw-0.13.2 → pyhw-0.13.4}/src/pyhw.egg-info/dependency_links.txt +0 -0
  131. {pyhw-0.13.2 → pyhw-0.13.4}/src/pyhw.egg-info/entry_points.txt +0 -0
  132. {pyhw-0.13.2 → pyhw-0.13.4}/src/pyhw.egg-info/top_level.txt +0 -0
  133. {pyhw-0.13.2 → pyhw-0.13.4}/test/test_cliUtil.py +0 -0
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: pyhw
3
- Version: 0.13.2
3
+ Version: 0.13.4
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.5
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
@@ -30,6 +30,8 @@ Dynamic: license-file
30
30
  ![Static Badge](https://img.shields.io/badge/aarch64-blue)
31
31
  ![Static Badge](https://img.shields.io/badge/arm32-yellow)
32
32
  ![Static Badge](https://img.shields.io/badge/riscv64-%238A2BE2)
33
+ ![Static Badge](https://img.shields.io/badge/ppc64-orange)
34
+ ![Static Badge](https://img.shields.io/badge/s390x-red)
33
35
 
34
36
 
35
37
  PyHw, a neofetch-like command line tool for fetching system information but written mostly in Python.
@@ -12,6 +12,8 @@
12
12
  ![Static Badge](https://img.shields.io/badge/aarch64-blue)
13
13
  ![Static Badge](https://img.shields.io/badge/arm32-yellow)
14
14
  ![Static Badge](https://img.shields.io/badge/riscv64-%238A2BE2)
15
+ ![Static Badge](https://img.shields.io/badge/ppc64-orange)
16
+ ![Static Badge](https://img.shields.io/badge/s390x-red)
15
17
 
16
18
 
17
19
  PyHw, a neofetch-like command line tool for fetching system information but written mostly in Python.
@@ -4,7 +4,7 @@ build-backend = "setuptools.build_meta"
4
4
 
5
5
  [project]
6
6
  name = "pyhw"
7
- version = "0.13.2"
7
+ version = "0.13.4"
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.5"
20
+ "pypci-ng>=0.2.6"
21
21
  ]
22
22
  classifiers = [
23
23
  "Development Status :: 4 - Beta",
@@ -1,2 +1,2 @@
1
- __version__ = '0.13.2'
1
+ __version__ = '0.13.4'
2
2
  __author__ = 'xiaoran007'
@@ -16,6 +16,7 @@ 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
19
20
 
20
21
 
21
22
  def check_release(release_dict):
@@ -76,7 +77,21 @@ def detect_npu(os, result_dict):
76
77
  result_dict["NPU"] = npu_info.npus
77
78
 
78
79
 
80
+ def print_version():
81
+ releaseChecker = ReleaseChecker()
82
+ print(f"pyhw v{releaseChecker.CurrentVersion}")
83
+
84
+
79
85
  def main():
86
+ parser = argparse.ArgumentParser(description='PyHw, a neofetch-like command line tool for fetching system information')
87
+ parser.add_argument('-v', '--version', action='store_true', help='Print version information and exit')
88
+
89
+ args = parser.parse_args()
90
+
91
+ if args.version:
92
+ print_version()
93
+ return
94
+
80
95
  current_os = getOS()
81
96
  if current_os not in ["linux", "macos", "freebsd", "windows"]:
82
97
  print(f"Only Linux, macOS, FreeBSD, and Windows are supported for now. Current OS: {current_os}")
@@ -48,7 +48,20 @@ class CPUDetectLinux:
48
48
  else:
49
49
  for line in cpu_info.split("\n"):
50
50
  if line.startswith("cpu MHz") or line.startswith("clock"):
51
- self.__cpuInfo.frequency = f"{round(float(line.split(':')[1].strip()) / 1000, 2)} Ghz" # Ghz
51
+ value_str = line.split(':')[1].strip()
52
+ try:
53
+ freq_value = float(value_str)
54
+ self.__cpuInfo.frequency = f"{round(freq_value / 1000, 2)} Ghz"
55
+ except ValueError:
56
+ match = re.search(r'(\d+(?:\.\d+)?)', value_str)
57
+ if match:
58
+ freq_value = float(match.group(1))
59
+ if 'MHz' in value_str:
60
+ self.__cpuInfo.frequency = f"{round(freq_value / 1000, 2)} Ghz"
61
+ elif 'GHz' in value_str:
62
+ self.__cpuInfo.frequency = f"{round(freq_value, 2)} Ghz"
63
+ else:
64
+ self.__cpuInfo.frequency = f"{round(freq_value / 1000, 2)} Ghz"
52
65
  break
53
66
 
54
67
  def __modelClean(self):
@@ -1,5 +1,7 @@
1
1
  from .cpuInfo import CPUInfo
2
2
  from ...pyhwUtil import sysctlGetString, sysctlGetInt, getArch
3
+ import ctypes
4
+ from pathlib import Path
3
5
 
4
6
 
5
7
  class CPUDetectMacOS:
@@ -11,11 +13,13 @@ class CPUDetectMacOS:
11
13
 
12
14
  def getCPUInfo(self):
13
15
  if self.__arch == "aarch64":
16
+ # For Apple Silicon Macs, we need to handle the CPU differently.
14
17
  self.__getCPUModel()
15
- self.__AppleSiliconBaseFrequency()
18
+ self.__AppleSiliconIOKitFrequency()
16
19
  self.__handleAppleSilicon()
17
20
  self.__cpuInfo.cpu = f"{self.__cpuInfo.model} ({self.__pCore}P, {self.__eCore}E) @ {self.__cpuInfo.frequency}"
18
21
  else:
22
+ # For Intel Macs, we can use sysctl to get the CPU information.
19
23
  self.__getCPUModel()
20
24
  self.__getCPUCores()
21
25
  self.__getCPUFrequency()
@@ -50,6 +54,21 @@ class CPUDetectMacOS:
50
54
  self.__pCore = pcore
51
55
  self.__eCore = ecore
52
56
 
57
+ def __AppleSiliconIOKitFrequency(self):
58
+ try:
59
+ package_root = Path(__file__).resolve().parent.parent.parent
60
+ lib = ctypes.CDLL(f"{package_root}/library/lib/iokitCPULib.dylib")
61
+ lib.get_apple_silicon_max_frequency.restype = ctypes.c_double
62
+ max_freq = lib.get_apple_silicon_max_frequency()
63
+ if max_freq != 0:
64
+ self.__cpuInfo.frequency = f"{max_freq:.2f} GHz"
65
+ else:
66
+ # If the IOKit library fails, we can fallback to the base frequency.
67
+ self.__AppleSiliconBaseFrequency()
68
+ except Exception as e:
69
+ # If the IOKit library fails, we can fallback to the base frequency.
70
+ self.__AppleSiliconBaseFrequency()
71
+
53
72
  def __AppleSiliconBaseFrequency(self):
54
73
  # see https://en.wikipedia.org/wiki/Apple_silicon#M_series for more details.
55
74
  # https://eclecticlight.co/2025/01/20/what-are-cpu-core-frequencies-in-apple-silicon-macs/
@@ -66,7 +85,7 @@ class CPUDetectMacOS:
66
85
  "Apple M3 Pro": "4.05 GHz",
67
86
  "Apple M3 Max": "4.05 GHz",
68
87
  "Apple M3 Ultra": "4.05 GHz", # Need more info
69
- "Apple M4": "4.40 GHz",
88
+ "Apple M4": "4.46 GHz",
70
89
  "Apple M4 Pro": "4.51 GHz",
71
90
  "Apple M4 Max": "4.51 GHz"
72
91
  }
@@ -39,6 +39,10 @@ class GPUDetectLinux:
39
39
  device_name = f"{device.vendor_name} {device.device_name} [{device.subsystem_device_name}] {core_print}"
40
40
  else:
41
41
  device_name = f"{device.vendor_name} {device.device_name} {core_print}"
42
+
43
+ if not device_name.strip():
44
+ device_name = f"{device.class_name}"
45
+
42
46
  self.__gpuInfo.gpus.append(self.__gpuNameClean(device_name))
43
47
  self.__gpuInfo.number += 1
44
48
 
@@ -41,7 +41,7 @@ class HostDetectLinux:
41
41
  self._hostInfo.model = self._hostInfo.name + " " + self._hostInfo.version
42
42
  except FileNotFoundError:
43
43
  pass
44
- elif self._arch in ["aarch64", "arm32", "riscv64"]:
44
+ elif self._arch in ["aarch64", "arm32", "riscv64", "ppc64le", "mips64"]:
45
45
  # try to find dmi folder since some arm based desktops and servers may have same structure as x86_64 machines.
46
46
  if os.path.exists("/sys/devices/virtual/dmi/id"):
47
47
  try:
@@ -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} {getArch()}"
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} {getArch()}"
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,15 @@
1
+ import ctypes
2
+
3
+
4
+ def main():
5
+ lib = ctypes.CDLL(f"../lib/iokitCPULib.dylib")
6
+ lib.get_apple_silicon_max_frequency.restype = ctypes.c_double
7
+ max_freq = lib.get_apple_silicon_max_frequency()
8
+ print(max_freq)
9
+ # gpus = host_info.decode('utf-8').split("; ")
10
+
11
+
12
+ if __name__ == "__main__":
13
+ main()
14
+
15
+
@@ -5,7 +5,7 @@ from dataclasses import dataclass
5
5
  import subprocess
6
6
 
7
7
 
8
- def getOS():
8
+ def getOS() -> str:
9
9
  """
10
10
  Get the os type in lower case.
11
11
  :return: str, os type, value in [windows, linux, macos, freebsd, unknown].
@@ -23,10 +23,10 @@ def getOS():
23
23
  return "unknown"
24
24
 
25
25
 
26
- def getArch():
26
+ def getArch() -> str:
27
27
  """
28
28
  Get the machine architecture.
29
- :return: str, value in [x86_64, x86, aarch64, arm32, riscv64, s390x, ppc64le].
29
+ :return: str, value in [x86_64, x86, aarch64, arm32, riscv64, s390x, ppc64le, mips64].
30
30
  """
31
31
  arch = platform.machine()
32
32
  if arch == "x86_64" or arch == "AMD64" or arch == "amd64":
@@ -43,6 +43,8 @@ def getArch():
43
43
  return "s390x"
44
44
  elif arch == "ppc64le":
45
45
  return "ppc64le"
46
+ elif arch == "mips64":
47
+ return "mips64"
46
48
  else:
47
49
  return "unknown"
48
50
 
@@ -157,7 +159,7 @@ class DataStringProcessor:
157
159
  return ret_str
158
160
 
159
161
 
160
- def createDataString(data: Data):
162
+ def createDataString(data: Data) -> str:
161
163
  data_string_processor = DataStringProcessor(data)
162
164
  data_string = ""
163
165
  data_string += data_string_processor.getTitle()
@@ -175,7 +177,7 @@ def createDataString(data: Data):
175
177
  return data_string
176
178
 
177
179
 
178
- def createDataStringOld(data: Data):
180
+ def createDataStringOld(data: Data) -> str:
179
181
  data_string = ""
180
182
  data_string += f" {data.title}\n"
181
183
  data_string += f" {'-'*len(data.title)}\n"
@@ -195,7 +197,7 @@ def createDataStringOld(data: Data):
195
197
  return data_string
196
198
 
197
199
 
198
- def selectOSLogo(os_id: str):
200
+ def selectOSLogo(os_id: str) -> str:
199
201
  """
200
202
  Select the logo based on the os id and terminal size.
201
203
  :param os_id: str, os id.
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: pyhw
3
- Version: 0.13.2
3
+ Version: 0.13.4
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.5
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
@@ -30,6 +30,8 @@ Dynamic: license-file
30
30
  ![Static Badge](https://img.shields.io/badge/aarch64-blue)
31
31
  ![Static Badge](https://img.shields.io/badge/arm32-yellow)
32
32
  ![Static Badge](https://img.shields.io/badge/riscv64-%238A2BE2)
33
+ ![Static Badge](https://img.shields.io/badge/ppc64-orange)
34
+ ![Static Badge](https://img.shields.io/badge/s390x-red)
33
35
 
34
36
 
35
37
  PyHw, a neofetch-like command line tool for fetching system information but written mostly in Python.
@@ -117,6 +117,7 @@ src/pyhw/library/lib/iokitGPULib.dylib
117
117
  src/pyhw/library/lib/iokitHostLib.dylib
118
118
  src/pyhw/library/lib/nvmlGPULib_amd64.so
119
119
  src/pyhw/library/lib/nvmlGPULib_arm64.so
120
+ src/pyhw/library/test/iokitCPULibTest.py
120
121
  src/pyhw/library/test/iokitHostLibTest.py
121
122
  src/pyhw/library/test/nvmlGPULibTest.py
122
123
  src/pyhw/pyhwException/__init__.py
@@ -0,0 +1 @@
1
+ pypci-ng>=0.2.6
@@ -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