pyhw 0.6.0__py3-none-any.whl → 0.6.2__py3-none-any.whl

Sign up to get free protection for your applications and to get access to all the features.
pyhw/backend/gpu/macos.py CHANGED
@@ -36,7 +36,7 @@ class GPUDetectMacOS:
36
36
  def __getGPUIntel(self):
37
37
  if self.__getGPUIOKit():
38
38
  pass
39
- else:
39
+ else: # fallback to the default implementation
40
40
  gpus = list()
41
41
  try:
42
42
  gpu_info_dict = json.loads(subprocess.check_output(["system_profiler", "SPDisplaysDataType", "-json"]))
@@ -58,7 +58,7 @@ class GPUDetectMacOS:
58
58
 
59
59
  def __getGPUIOKit(self):
60
60
  try:
61
- package_root = Path(__file__).resolve().parent.parent
61
+ package_root = Path(__file__).resolve().parent.parent.parent
62
62
  lib = ctypes.CDLL(f"{package_root}/library/lib/iokitGPULib.dylib")
63
63
  lib.getGPUInfo.restype = ctypes.c_char_p
64
64
  gpu_info = lib.getGPUInfo()
@@ -68,14 +68,14 @@ class GPUDetectMacOS:
68
68
  info_list = gpu.split(", ")
69
69
  model = info_list[0]
70
70
  vendor_id = info_list[1]
71
- vram = int(info_list[2]) / 1024
71
+ vram = round(int(info_list[2]) / 1024, None)
72
72
  if self.__handleVendorID(vendor_id) == "Intel": # Integrated GPU
73
73
  self.__gpuInfo.gpus.append(f'{model} [CPU Integrated]')
74
74
  elif self.__handleVendorID(vendor_id) == "AMD": # dGPU
75
75
  self.__gpuInfo.gpus.append(f'{model} {vram} GB [Discrete]')
76
76
  return True
77
77
  except Exception as e:
78
- print(f"An error occurred while getting GPU info using IOKit: {e}")
78
+ # print(f"An error occurred while getting GPU info using IOKit: {e}")
79
79
  return False
80
80
 
81
81
  @staticmethod
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: pyhw
3
- Version: 0.6.0
3
+ Version: 0.6.2
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
@@ -82,6 +82,7 @@ This is due to the fact that system python is not supposed to be managed by pip.
82
82
 
83
83
 
84
84
  ## Build from source
85
+ Currently, build process relay on swiftc and macOS IOKit framework. To build package from source, you need a mac machine with macOS 11 and newer.
85
86
  ### Build tools
86
87
  Make sure the following Python build tools are already installed.
87
88
  * setuptools
@@ -12,7 +12,7 @@ pyhw/backend/gpu/__init__.py,sha256=EpMjPvUaXt0LTNMvGmB8WgXbUB9keCxuOhu8NT3Re6o,
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
14
  pyhw/backend/gpu/linux.py,sha256=E-evoL-spQbHB8JvbZXSq5ypc2SeePVUPnhEQrSPQpg,1619
15
- pyhw/backend/gpu/macos.py,sha256=J6BjGGzsMjwqtw6YbRaYK903s2CC7CefJKcVwyUFNV4,3786
15
+ pyhw/backend/gpu/macos.py,sha256=SmTqqTrIMRW-GVPmDs8xAiOX7HsCjrGh9qkxLQCdvO8,3850
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
18
18
  pyhw/backend/host/hostInfo.py,sha256=Xvz0LugPiCSWMkcDsp4p2rrojYFZauL6Q-gCZ6NLz5k,184
@@ -77,16 +77,15 @@ pyhw/frontend/logo/ascii/macOS.pyhw,sha256=HBGROtBb7wrNtRqAQ9ND7zxK0l17BRsmpgc2d
77
77
  pyhw/frontend/logo/ascii/raspbian.pyhw,sha256=jEl6WMKF-FGx359ipQ1kzweUJS-NuauYQCFaYime4PQ,159
78
78
  pyhw/frontend/logo/ascii/ubuntu.pyhw,sha256=l-Q0PfutxXYMwTojqeiM88063x4V0RBkZUHmi6YdsNc,833
79
79
  pyhw/frontend/logo/ascii/ubuntu_small.pyhw,sha256=Xf8LSZdZUu9aEG3efhb1FUlUEuJ-3UztcIOJISpKhPw,229
80
- pyhw/library/iokitGPULib/te.py,sha256=UbRUT82ckEFWP_r1-52wGFhaVO9bGSsON_NTBeTawCw,294
81
80
  pyhw/library/lib/iokitGPULib.dylib,sha256=DcJ0GZY79gTFckLFYtZgeKn1T0NFvdO_k_ccCa7od5Y,154808
82
81
  pyhw/pyhwException/__init__.py,sha256=8JsFvtF13g0Y5t4z9fRndDXtfCzuBM59jDf6PhWSFSk,220
83
82
  pyhw/pyhwException/pyhwException.py,sha256=wxuzFQa9g7XB1q9TUKO_55lw7wMEJMpzG8w1GVTFVa0,197
84
83
  pyhw/pyhwUtil/__init__.py,sha256=PzeP9fXsIhvr3sUpJ4DxW9_H25DEIasBFfXd_NztfR4,226
85
84
  pyhw/pyhwUtil/pyhwUtil.py,sha256=CKXJrt6KGhZCV1J7MjsQ21c_jPmC1I3wZBPCKJfdqbM,2478
86
85
  pyhw/pyhwUtil/sysctlUtil.py,sha256=S-rUvqi7ZrMyMouIhxlyHEQ4agM7sCT1Y7uzs3Hu5-o,841
87
- pyhw-0.6.0.dist-info/LICENSE,sha256=hJs6RBqSVCexbTsalkMLNFI5t06kekQEsSVaOt_-yLs,1497
88
- pyhw-0.6.0.dist-info/METADATA,sha256=tc8zhFjdGBZG5sWdem_ABeGpEqe35P6cq2dSDDcXofo,4196
89
- pyhw-0.6.0.dist-info/WHEEL,sha256=OVMc5UfuAQiSplgO0_WdW7vXVGAt9Hdd6qtN4HotdyA,91
90
- pyhw-0.6.0.dist-info/entry_points.txt,sha256=q-AB8im_QahpmNrmy4aPTJRGi0LlbNlnI3kF7s6pKss,44
91
- pyhw-0.6.0.dist-info/top_level.txt,sha256=7Inxvxt1TngEricKZEex9_WJZS3DbKYFUXDz4v5WHYU,5
92
- pyhw-0.6.0.dist-info/RECORD,,
86
+ pyhw-0.6.2.dist-info/LICENSE,sha256=hJs6RBqSVCexbTsalkMLNFI5t06kekQEsSVaOt_-yLs,1497
87
+ pyhw-0.6.2.dist-info/METADATA,sha256=8hoIX15dNDXmCpEzBrd5d4i_7BiHopdQYYglyPo_R1U,4342
88
+ pyhw-0.6.2.dist-info/WHEEL,sha256=P9jw-gEje8ByB7_hXoICnHtVCrEwMQh-630tKvQWehc,91
89
+ pyhw-0.6.2.dist-info/entry_points.txt,sha256=q-AB8im_QahpmNrmy4aPTJRGi0LlbNlnI3kF7s6pKss,44
90
+ pyhw-0.6.2.dist-info/top_level.txt,sha256=7Inxvxt1TngEricKZEex9_WJZS3DbKYFUXDz4v5WHYU,5
91
+ pyhw-0.6.2.dist-info/RECORD,,
@@ -1,5 +1,5 @@
1
1
  Wheel-Version: 1.0
2
- Generator: setuptools (75.2.0)
2
+ Generator: setuptools (75.3.0)
3
3
  Root-Is-Purelib: true
4
4
  Tag: py3-none-any
5
5
 
@@ -1,12 +0,0 @@
1
- import ctypes
2
-
3
- # Load the dynamic library
4
- lib = ctypes.CDLL('./iokitGPULib.dylib')
5
-
6
- # Define the function return type as c_char_p (pointer to C char)
7
- lib.getGPUInfo.restype = ctypes.c_char_p
8
-
9
- # Call the function and get the result
10
- gpu_info = lib.getGPUInfo()
11
- print("Detected GPUs:", gpu_info)
12
-
File without changes