pyhw 0.7.4__py3-none-any.whl → 0.9.0__py3-none-any.whl
Sign up to get free protection for your applications and to get access to all the features.
- pyhw/__init__.py +1 -1
- pyhw/__main__.py +2 -2
- pyhw/backend/cpu/cpuBase.py +6 -3
- pyhw/backend/cpu/linux.py +3 -0
- pyhw/backend/cpu/windows.py +48 -0
- pyhw/backend/gpu/gpuBase.py +8 -4
- pyhw/backend/gpu/linux.py +1 -1
- pyhw/backend/gpu/windows.py +41 -0
- pyhw/backend/host/hostBase.py +5 -5
- pyhw/backend/host/hostInfo.py +17 -8
- pyhw/backend/host/linux.py +1 -1
- pyhw/backend/host/windows.py +32 -1
- pyhw/backend/kernel/kernelBase.py +3 -2
- pyhw/backend/kernel/kernelInfo.py +6 -0
- pyhw/backend/kernel/windows.py +32 -1
- pyhw/backend/memory/memoryBase.py +8 -4
- pyhw/backend/memory/windows.py +36 -0
- pyhw/backend/nic/linux.py +2 -0
- pyhw/backend/nic/nicBase.py +8 -4
- pyhw/backend/nic/windows.py +44 -0
- pyhw/backend/npu/linux.py +18 -2
- pyhw/backend/npu/npuBase.py +8 -6
- pyhw/backend/npu/windows.py +40 -0
- pyhw/backend/os/osBase.py +6 -3
- pyhw/backend/os/osInfo.py +6 -0
- pyhw/backend/os/windows.py +43 -0
- pyhw/backend/shell/shellBase.py +4 -1
- pyhw/backend/shell/shellInfo.py +10 -0
- pyhw/backend/shell/unix.py +2 -10
- pyhw/backend/shell/windows.py +29 -0
- pyhw/backend/title/titleBase.py +2 -2
- pyhw/backend/title/titleInfo.py +9 -0
- pyhw/backend/title/unix.py +2 -9
- pyhw/backend/title/windows.py +10 -1
- pyhw/backend/uptime/linux.py +3 -3
- pyhw/backend/uptime/macos.py +3 -3
- pyhw/backend/uptime/uptimeBase.py +6 -3
- pyhw/backend/uptime/windows.py +49 -0
- pyhw/frontend/color/colorConfig.py +52 -0
- pyhw/frontend/logo/ascii/windows_10.pyhw +19 -0
- pyhw/frontend/logo/ascii/windows_11.pyhw +17 -0
- pyhw/frontend/logo/ascii/windows_2025.pyhw +17 -0
- pyhw/frontend/logo/ascii/windows_old.pyhw +16 -0
- pyhw/pyhwUtil/pyhwUtil.py +13 -4
- {pyhw-0.7.4.dist-info → pyhw-0.9.0.dist-info}/METADATA +8 -4
- {pyhw-0.7.4.dist-info → pyhw-0.9.0.dist-info}/RECORD +50 -36
- {pyhw-0.7.4.dist-info → pyhw-0.9.0.dist-info}/LICENSE +0 -0
- {pyhw-0.7.4.dist-info → pyhw-0.9.0.dist-info}/WHEEL +0 -0
- {pyhw-0.7.4.dist-info → pyhw-0.9.0.dist-info}/entry_points.txt +0 -0
- {pyhw-0.7.4.dist-info → pyhw-0.9.0.dist-info}/top_level.txt +0 -0
@@ -0,0 +1,43 @@
|
|
1
|
+
from .osInfo import OSInfo
|
2
|
+
from ...pyhwException import BackendException
|
3
|
+
import platform
|
4
|
+
import winreg
|
5
|
+
|
6
|
+
|
7
|
+
class OSDetectWindows:
|
8
|
+
def __init__(self):
|
9
|
+
self._osInfo = OSInfo()
|
10
|
+
|
11
|
+
def getOSInfo(self):
|
12
|
+
system = platform.system()
|
13
|
+
release = platform.release()
|
14
|
+
edition = platform.win32_edition()
|
15
|
+
machine = platform.machine()
|
16
|
+
display = self.__get_windows_version()
|
17
|
+
if display != "":
|
18
|
+
self._osInfo.prettyName = f"{system} {release} {display} ({edition}) {machine}"
|
19
|
+
else:
|
20
|
+
self._osInfo.prettyName = f"{system} {release} ({edition}) {machine}"
|
21
|
+
if release == "10":
|
22
|
+
self._osInfo.id = "windows_10"
|
23
|
+
elif release == "11":
|
24
|
+
self._osInfo.id = "windows_11"
|
25
|
+
else:
|
26
|
+
self._osInfo.id = "windows_old"
|
27
|
+
return self._osInfo
|
28
|
+
|
29
|
+
@staticmethod
|
30
|
+
def __get_windows_version():
|
31
|
+
try:
|
32
|
+
key = winreg.OpenKey(winreg.HKEY_LOCAL_MACHINE, r"SOFTWARE\Microsoft\Windows NT\CurrentVersion")
|
33
|
+
display_version, _ = winreg.QueryValueEx(key, "DisplayVersion")
|
34
|
+
winreg.CloseKey(key)
|
35
|
+
return str(display_version)
|
36
|
+
except:
|
37
|
+
try:
|
38
|
+
key = winreg.OpenKey(winreg.HKEY_LOCAL_MACHINE, r"SOFTWARE\Microsoft\Windows NT\CurrentVersion")
|
39
|
+
release_id, _ = winreg.QueryValueEx(key, "ReleaseId")
|
40
|
+
winreg.CloseKey(key)
|
41
|
+
return str(release_id)
|
42
|
+
except:
|
43
|
+
return ""
|
pyhw/backend/shell/shellBase.py
CHANGED
@@ -1,4 +1,3 @@
|
|
1
|
-
from .unix import ShellDetectUnix
|
2
1
|
from ...pyhwException import OSUnsupportedException
|
3
2
|
|
4
3
|
|
@@ -8,6 +7,10 @@ class ShellDetect:
|
|
8
7
|
|
9
8
|
def getShellInfo(self):
|
10
9
|
if self.OS in ["linux", "macos", "freebsd"]:
|
10
|
+
from .unix import ShellDetectUnix
|
11
11
|
return ShellDetectUnix().getShellInfo()
|
12
|
+
elif self.OS == "windows":
|
13
|
+
from .windows import ShellDetectWindows
|
14
|
+
return ShellDetectWindows().getShellInfo()
|
12
15
|
else:
|
13
16
|
raise OSUnsupportedException("Unsupported operating system")
|
pyhw/backend/shell/unix.py
CHANGED
@@ -2,22 +2,14 @@
|
|
2
2
|
In dev.
|
3
3
|
"""
|
4
4
|
from ...pyhwUtil import getDocker
|
5
|
-
from
|
5
|
+
from .shellInfo import ShellInfo
|
6
6
|
import os
|
7
7
|
import subprocess
|
8
8
|
|
9
9
|
|
10
|
-
@dataclass
|
11
|
-
class ShellInfoUnix:
|
12
|
-
shell = ""
|
13
|
-
version = ""
|
14
|
-
path = ""
|
15
|
-
info = ""
|
16
|
-
|
17
|
-
|
18
10
|
class ShellDetectUnix:
|
19
11
|
def __init__(self):
|
20
|
-
self.__shellInfo =
|
12
|
+
self.__shellInfo = ShellInfo()
|
21
13
|
|
22
14
|
def getShellInfo(self):
|
23
15
|
if getDocker():
|
@@ -0,0 +1,29 @@
|
|
1
|
+
"""
|
2
|
+
In dev.
|
3
|
+
"""
|
4
|
+
from ...pyhwException import BackendException
|
5
|
+
from .shellInfo import ShellInfo
|
6
|
+
import json
|
7
|
+
import subprocess
|
8
|
+
|
9
|
+
|
10
|
+
class ShellDetectWindows:
|
11
|
+
def __init__(self):
|
12
|
+
self.__shellInfo = ShellInfo()
|
13
|
+
|
14
|
+
def getShellInfo(self):
|
15
|
+
COMMAND = "$PSVersionTable.PSVersion | ConvertTo-JSON"
|
16
|
+
|
17
|
+
try:
|
18
|
+
result = subprocess.run(["powershell", "-NoProfile", "-Command", COMMAND], capture_output=True, text=True)
|
19
|
+
except subprocess.SubprocessError:
|
20
|
+
raise BackendException("Error running PowerShell command.")
|
21
|
+
|
22
|
+
res = json.loads(result.stdout)
|
23
|
+
major = res["Major"]
|
24
|
+
minor = res["Minor"]
|
25
|
+
|
26
|
+
self.__shellInfo.shell = "PowerShell"
|
27
|
+
self.__shellInfo.version = f"{major}.{minor}"
|
28
|
+
self.__shellInfo.info = f"PowerShell {major}.{minor}"
|
29
|
+
return self.__shellInfo
|
pyhw/backend/title/titleBase.py
CHANGED
@@ -1,5 +1,3 @@
|
|
1
|
-
from .unix import TitleDetectUnix
|
2
|
-
from .windows import TitleDetectWindows
|
3
1
|
from ...pyhwException import OSUnsupportedException
|
4
2
|
|
5
3
|
|
@@ -9,8 +7,10 @@ class TitleDetect:
|
|
9
7
|
|
10
8
|
def getTitle(self):
|
11
9
|
if self.OS in ["linux", "macos", "freebsd"]:
|
10
|
+
from .unix import TitleDetectUnix
|
12
11
|
return TitleDetectUnix().getTitle()
|
13
12
|
elif self.OS == "windows":
|
13
|
+
from .windows import TitleDetectWindows
|
14
14
|
return TitleDetectWindows().getTitle()
|
15
15
|
else:
|
16
16
|
raise OSUnsupportedException("Unsupported operating system")
|
pyhw/backend/title/unix.py
CHANGED
@@ -2,19 +2,12 @@
|
|
2
2
|
In dev.
|
3
3
|
"""
|
4
4
|
import subprocess
|
5
|
-
from
|
6
|
-
|
7
|
-
|
8
|
-
@dataclass
|
9
|
-
class TitleInfoUnix:
|
10
|
-
username = ""
|
11
|
-
hostname = ""
|
12
|
-
title = ""
|
5
|
+
from .titleInfo import TitleInfo
|
13
6
|
|
14
7
|
|
15
8
|
class TitleDetectUnix:
|
16
9
|
def __init__(self):
|
17
|
-
self.__titleInfo =
|
10
|
+
self.__titleInfo = TitleInfo()
|
18
11
|
|
19
12
|
def getTitle(self):
|
20
13
|
self.__getTitle()
|
pyhw/backend/title/windows.py
CHANGED
@@ -1,8 +1,17 @@
|
|
1
1
|
"""
|
2
2
|
In dev.
|
3
3
|
"""
|
4
|
+
from .titleInfo import TitleInfo
|
5
|
+
import getpass
|
6
|
+
import platform
|
4
7
|
|
5
8
|
|
6
9
|
class TitleDetectWindows:
|
10
|
+
def __init__(self):
|
11
|
+
self.__titleInfo = TitleInfo()
|
12
|
+
|
7
13
|
def getTitle(self):
|
8
|
-
|
14
|
+
self.__titleInfo.username = getpass.getuser()
|
15
|
+
self.__titleInfo.hostname = platform.node()
|
16
|
+
self.__titleInfo.title = f"{self.__titleInfo.username}@{self.__titleInfo.hostname}"
|
17
|
+
return self.__titleInfo
|
pyhw/backend/uptime/linux.py
CHANGED
@@ -24,8 +24,8 @@ class UptimeDetectLinux:
|
|
24
24
|
seconds = int(seconds)
|
25
25
|
if days == 0:
|
26
26
|
if hours == 0:
|
27
|
-
self.__uptimeInfo.uptime = f"{minutes}
|
27
|
+
self.__uptimeInfo.uptime = f"{minutes} mins {seconds} secs"
|
28
28
|
else:
|
29
|
-
self.__uptimeInfo.uptime = f"{hours} hours {minutes}
|
29
|
+
self.__uptimeInfo.uptime = f"{hours} hours {minutes} mins {seconds} secs"
|
30
30
|
else:
|
31
|
-
self.__uptimeInfo.uptime = f"{days} days {hours} hours {minutes}
|
31
|
+
self.__uptimeInfo.uptime = f"{days} days {hours} hours {minutes} mins {seconds} secs"
|
pyhw/backend/uptime/macos.py
CHANGED
@@ -22,11 +22,11 @@ class UptimeDetectMacOS:
|
|
22
22
|
seconds = int(seconds)
|
23
23
|
if days == 0:
|
24
24
|
if hours == 0:
|
25
|
-
self._uptimeInfo.uptime = f"{minutes}
|
25
|
+
self._uptimeInfo.uptime = f"{minutes} mins {seconds} secs"
|
26
26
|
else:
|
27
|
-
self._uptimeInfo.uptime = f"{hours} hours {minutes}
|
27
|
+
self._uptimeInfo.uptime = f"{hours} hours {minutes} mins {seconds} secs"
|
28
28
|
else:
|
29
|
-
self._uptimeInfo.uptime = f"{days} days {hours} hours {minutes}
|
29
|
+
self._uptimeInfo.uptime = f"{days} days {hours} hours {minutes} mins {seconds} secs"
|
30
30
|
return self._uptimeInfo
|
31
31
|
|
32
32
|
def _getUptime(self):
|
@@ -1,6 +1,3 @@
|
|
1
|
-
from .linux import UptimeDetectLinux
|
2
|
-
from .macos import UptimeDetectMacOS
|
3
|
-
from .bsd import UptimeDetectBSD
|
4
1
|
from ...pyhwException import OSUnsupportedException
|
5
2
|
|
6
3
|
|
@@ -17,10 +14,16 @@ class UptimeDetect:
|
|
17
14
|
:return: dataclass UptimeInfo, direct attr: uptime
|
18
15
|
"""
|
19
16
|
if self.OS == "linux":
|
17
|
+
from .linux import UptimeDetectLinux
|
20
18
|
return UptimeDetectLinux().getUptimeInfo()
|
21
19
|
elif self.OS == "macos":
|
20
|
+
from .macos import UptimeDetectMacOS
|
22
21
|
return UptimeDetectMacOS().getUptimeInfo()
|
23
22
|
elif self.OS == "freebsd":
|
23
|
+
from .bsd import UptimeDetectBSD
|
24
24
|
return UptimeDetectBSD().getUptimeInfo()
|
25
|
+
elif self.OS == "windows":
|
26
|
+
from .windows import UptimeDetectWindows
|
27
|
+
return UptimeDetectWindows().getUptimeInfo()
|
25
28
|
else:
|
26
29
|
raise OSUnsupportedException("Unsupported operating system")
|
@@ -0,0 +1,49 @@
|
|
1
|
+
from ...pyhwException import BackendException
|
2
|
+
from .uptimeInfo import UptimeInfo
|
3
|
+
import subprocess
|
4
|
+
import json
|
5
|
+
import re
|
6
|
+
from datetime import datetime
|
7
|
+
|
8
|
+
|
9
|
+
class UptimeDetectWindows:
|
10
|
+
def __init__(self):
|
11
|
+
self.__uptimeInfo = UptimeInfo()
|
12
|
+
|
13
|
+
def getUptimeInfo(self):
|
14
|
+
self.__getUptime()
|
15
|
+
return self.__uptimeInfo
|
16
|
+
|
17
|
+
def __getUptime(self):
|
18
|
+
COMMAND = 'Get-CimInstance -ClassName Win32_OperatingSystem | Select-Object LastBootUpTime | ConvertTo-JSON'
|
19
|
+
try:
|
20
|
+
result = subprocess.run(["powershell", "-NoProfile", "-Command", COMMAND], capture_output=True, text=True)
|
21
|
+
except subprocess.SubprocessError:
|
22
|
+
raise BackendException("Error while getting system uptime")
|
23
|
+
|
24
|
+
res = json.loads(result.stdout)
|
25
|
+
timestamp_str = res['LastBootUpTime']
|
26
|
+
match = re.search(r'\d+', timestamp_str)
|
27
|
+
|
28
|
+
if match:
|
29
|
+
timestamp_ms = int(match.group(0))
|
30
|
+
last_boot_time = datetime.utcfromtimestamp(timestamp_ms / 1000)
|
31
|
+
current_time = datetime.utcnow()
|
32
|
+
uptime = current_time - last_boot_time
|
33
|
+
days = uptime.days
|
34
|
+
seconds = uptime.seconds
|
35
|
+
hours = seconds // 3600
|
36
|
+
minutes = (seconds % 3600) // 60
|
37
|
+
secs = (seconds % 3600) % 60
|
38
|
+
|
39
|
+
if days == 0:
|
40
|
+
if hours == 0:
|
41
|
+
self.__uptimeInfo.uptime = f"{minutes} mins {secs} secs"
|
42
|
+
else:
|
43
|
+
self.__uptimeInfo.uptime = f"{hours} hours {minutes} mins {secs} secs"
|
44
|
+
else:
|
45
|
+
self.__uptimeInfo.uptime = f"{days} days {hours} hours {minutes} mins {secs} secs"
|
46
|
+
else:
|
47
|
+
raise BackendException("Error while getting system uptime")
|
48
|
+
|
49
|
+
|
@@ -33,6 +33,14 @@ class ColorConfigSet:
|
|
33
33
|
return ColorConfigSetC.centos
|
34
34
|
elif self.__os_name == "freebsd":
|
35
35
|
return ColorConfigSetF.freebsd
|
36
|
+
elif self.__os_name == "windows_old":
|
37
|
+
return ColorConfigSetW.windows_old
|
38
|
+
elif self.__os_name == "windows_10":
|
39
|
+
return ColorConfigSetW.windows_10
|
40
|
+
elif self.__os_name == "windows_11":
|
41
|
+
return ColorConfigSetW.windows_11
|
42
|
+
elif self.__os_name == "windows_2025":
|
43
|
+
return ColorConfigSetW.windows_2025
|
36
44
|
else:
|
37
45
|
return ColorConfigSetL.linux # default to Linux
|
38
46
|
|
@@ -176,3 +184,47 @@ class ColorConfigSetU:
|
|
176
184
|
"colorKeys": ColorSet.COLOR_FG_RED,
|
177
185
|
"colorTitle": ColorSet.COLOR_FG_RED
|
178
186
|
}
|
187
|
+
|
188
|
+
|
189
|
+
@dataclass
|
190
|
+
class ColorConfigSetW:
|
191
|
+
windows_old = {
|
192
|
+
"colors": [
|
193
|
+
ColorSet.COLOR_FG_RED,
|
194
|
+
ColorSet.COLOR_FG_GREEN,
|
195
|
+
ColorSet.COLOR_FG_BLUE,
|
196
|
+
ColorSet.COLOR_FG_YELLOW
|
197
|
+
],
|
198
|
+
"colorKeys": ColorSet.COLOR_FG_BLUE,
|
199
|
+
"colorTitle": ColorSet.COLOR_FG_GREEN
|
200
|
+
}
|
201
|
+
windows_10 = {
|
202
|
+
"colors": [
|
203
|
+
ColorSet.COLOR_FG_CYAN,
|
204
|
+
ColorSet.COLOR_FG_CYAN,
|
205
|
+
ColorSet.COLOR_FG_CYAN,
|
206
|
+
ColorSet.COLOR_FG_CYAN
|
207
|
+
],
|
208
|
+
"colorKeys": ColorSet.COLOR_FG_YELLOW,
|
209
|
+
"colorTitle": ColorSet.COLOR_FG_GREEN
|
210
|
+
}
|
211
|
+
windows_11 = {
|
212
|
+
"colors": [
|
213
|
+
ColorSet.COLOR_FG_BLUE,
|
214
|
+
ColorSet.COLOR_FG_BLUE,
|
215
|
+
ColorSet.COLOR_FG_BLUE,
|
216
|
+
ColorSet.COLOR_FG_BLUE
|
217
|
+
],
|
218
|
+
"colorKeys": ColorSet.COLOR_FG_YELLOW,
|
219
|
+
"colorTitle": ColorSet.COLOR_FG_CYAN
|
220
|
+
}
|
221
|
+
windows_2025 = {
|
222
|
+
"colors": [
|
223
|
+
ColorSet.COLOR_FG_BLUE,
|
224
|
+
ColorSet.COLOR_FG_BLUE,
|
225
|
+
ColorSet.COLOR_FG_BLUE,
|
226
|
+
ColorSet.COLOR_FG_BLUE
|
227
|
+
],
|
228
|
+
"colorKeys": ColorSet.COLOR_FG_YELLOW,
|
229
|
+
"colorTitle": ColorSet.COLOR_FG_CYAN
|
230
|
+
}
|
@@ -0,0 +1,19 @@
|
|
1
|
+
$2..,
|
2
|
+
....,,:;+ccllll
|
3
|
+
$1 ...,,+:; $2cllllllllllllllllll
|
4
|
+
$1,cclllllllllll $2lllllllllllllllllll
|
5
|
+
$1llllllllllllll $2lllllllllllllllllll
|
6
|
+
$1llllllllllllll $2lllllllllllllllllll
|
7
|
+
$1llllllllllllll $2lllllllllllllllllll
|
8
|
+
$1llllllllllllll $2lllllllllllllllllll
|
9
|
+
$1llllllllllllll $2lllllllllllllllllll
|
10
|
+
|
11
|
+
$3llllllllllllll $4lllllllllllllllllll
|
12
|
+
$3llllllllllllll $4lllllllllllllllllll
|
13
|
+
$3llllllllllllll $4lllllllllllllllllll
|
14
|
+
$3llllllllllllll $4lllllllllllllllllll
|
15
|
+
$3llllllllllllll $4lllllllllllllllllll
|
16
|
+
$3`'ccllllllllll $4lllllllllllllllllll
|
17
|
+
$3 `' \*:: $4:ccllllllllllllllll
|
18
|
+
````''*::cll
|
19
|
+
``
|
@@ -0,0 +1,17 @@
|
|
1
|
+
$1///////////////// $2/////////////////
|
2
|
+
$1///////////////// $2/////////////////
|
3
|
+
$1///////////////// $2/////////////////
|
4
|
+
$1///////////////// $2/////////////////
|
5
|
+
$1///////////////// $2/////////////////
|
6
|
+
$1///////////////// $2/////////////////
|
7
|
+
$1///////////////// $2/////////////////
|
8
|
+
$1///////////////// $2/////////////////
|
9
|
+
|
10
|
+
$3///////////////// $4/////////////////
|
11
|
+
$3///////////////// $4/////////////////
|
12
|
+
$3///////////////// $4/////////////////
|
13
|
+
$3///////////////// $4/////////////////
|
14
|
+
$3///////////////// $4/////////////////
|
15
|
+
$3///////////////// $4/////////////////
|
16
|
+
$3///////////////// $4/////////////////
|
17
|
+
$3///////////////// $4/////////////////
|
@@ -0,0 +1,17 @@
|
|
1
|
+
$1 ##%%%%%%%%% $2%%%%%%%%%##
|
2
|
+
$1 ###%%%%%%%%%% $2%%%%%%%%%%###
|
3
|
+
$1 ####%%%%%%%%%%% $2%%%%%%%%%%%####
|
4
|
+
$1 ##%%%%%%%%%%%%%% $2%%%%%%%%%%%%%%##
|
5
|
+
$1#%%%%%%%%%%%%%%%% $2%%%%%%%%%%%%%%%%#
|
6
|
+
$1%%%%%%%%%%%%%%%%% $2%%%%%%%%%%%%%%%%%
|
7
|
+
$1%%%%%%%%%%%%%%%%% $2%%%%%%%%%%%%%%%%%
|
8
|
+
$1%%%%%%%%%%%%%%%%% $2#%%%%%%%%%%%%%%%%
|
9
|
+
|
10
|
+
$3%%%%%%%%%%%%%%%%% $4#%%%%%%%%%%%%%%%%
|
11
|
+
$3%%%%%%%%%%%%%%%%% $4%%%%%%%%%%%%%%%%%
|
12
|
+
$3%%%%%%%%%%%%%%%%% $4%%%%%%%%%%%%%%%%%
|
13
|
+
$3%%%%%%%%%%%%%%%%% $4%%%%%%%%%%%%%%%%#
|
14
|
+
$3 ###%%%%%%%%%%%%% $4%%%%%%%%%%%%%%%##
|
15
|
+
$3 ####%%%%%%%%%%% $4%%%%%%%%%%%#%####
|
16
|
+
$3 ##%#%%%%%%%%% $4%%%%%%%%%%%######
|
17
|
+
$3 ##%%%%%%%%% $4%%%%%%%%%########
|
@@ -0,0 +1,16 @@
|
|
1
|
+
$1 ,.=:!!t3Z3z.,
|
2
|
+
:tt:::tt333EE3
|
3
|
+
$1 Et:::ztt33EEEL$2 @Ee., ..,
|
4
|
+
$1 ;tt:::tt333EE7$2 ;EEEEEEttttt33#
|
5
|
+
$1 :Et:::zt333EEQ.$2 $EEEEEttttt33QL
|
6
|
+
$1 it::::tt333EEF$2 @EEEEEEttttt33F
|
7
|
+
$1 ;3=*^```"*4EEV$2 :EEEEEEttttt33@.
|
8
|
+
$3 ,.=::::!t=., $1`$2 @EEEEEEtttz33QF
|
9
|
+
$3 ;::::::::zt33)$2 "4EEEtttji3P*
|
10
|
+
$3 :t::::::::tt33.$4:Z3z..$2 ``$4 ,..g.
|
11
|
+
$3 i::::::::zt33F$4 AEEEtttt::::ztF
|
12
|
+
$3 ;:::::::::t33V$4 ;EEEttttt::::t3
|
13
|
+
$3 E::::::::zt33L$4 @EEEtttt::::z3F
|
14
|
+
$3{3=*^```"*4E3)$4 ;EEEtttt:::::tZ`
|
15
|
+
$3 `$4 :EEEEtttt::::z7
|
16
|
+
"VEzjt:;;z>*`
|
pyhw/pyhwUtil/pyhwUtil.py
CHANGED
@@ -25,7 +25,7 @@ def getOS():
|
|
25
25
|
def getArch():
|
26
26
|
"""
|
27
27
|
Get the machine architecture.
|
28
|
-
:return: str, value in [x86_64, x86, aarch64, arm32].
|
28
|
+
:return: str, value in [x86_64, x86, aarch64, arm32, riscv64].
|
29
29
|
"""
|
30
30
|
arch = platform.machine()
|
31
31
|
if arch == "x86_64" or arch == "AMD64" or arch == "amd64":
|
@@ -36,6 +36,8 @@ def getArch():
|
|
36
36
|
return "aarch64"
|
37
37
|
elif arch.find("arm") != -1:
|
38
38
|
return "arm32"
|
39
|
+
elif arch == "riscv64":
|
40
|
+
return "riscv64"
|
39
41
|
else:
|
40
42
|
return "unknown"
|
41
43
|
|
@@ -173,8 +175,10 @@ def createDataStringOld(data: Data):
|
|
173
175
|
|
174
176
|
@dataclass
|
175
177
|
class SupportedOS:
|
176
|
-
ColorConfig = ["armbian", "arch", "alpine", "centos", "debian", "fedora", "macOS", "raspbian", "ubuntu", "freebsd"
|
177
|
-
|
178
|
+
ColorConfig = ["armbian", "arch", "alpine", "centos", "debian", "fedora", "macOS", "raspbian", "ubuntu", "freebsd",
|
179
|
+
"windows_old", "windows_10", "windows_11", "windows_2025"]
|
180
|
+
AsciiLogo = ["armbian", "arch", "alpine", "centos", "debian", "fedora", "macOS", "raspbian", "ubuntu", "freebsd",
|
181
|
+
"windows_old", "windows_10", "windows_11", "windows_2025"]
|
178
182
|
|
179
183
|
|
180
184
|
def selectOSLogo(os_id: str):
|
@@ -183,8 +187,13 @@ def selectOSLogo(os_id: str):
|
|
183
187
|
:param os_id: str, os id.
|
184
188
|
:return: str, logo id.
|
185
189
|
"""
|
186
|
-
if getOS() == "macos":
|
190
|
+
if getOS() == "macos": # macOS does not have small logo
|
187
191
|
return os_id
|
192
|
+
if getOS() == "windows": # windows does not have small logo
|
193
|
+
if os_id in SupportedOS.ColorConfig and os_id in SupportedOS.AsciiLogo:
|
194
|
+
return os_id
|
195
|
+
else:
|
196
|
+
return "windows_11"
|
188
197
|
if os_id in SupportedOS.ColorConfig and os_id in SupportedOS.AsciiLogo:
|
189
198
|
pass
|
190
199
|
else:
|
@@ -1,6 +1,6 @@
|
|
1
1
|
Metadata-Version: 2.2
|
2
2
|
Name: pyhw
|
3
|
-
Version: 0.
|
3
|
+
Version: 0.9.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,21 +13,24 @@ 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.
|
16
|
+
Requires-Dist: pypci-ng>=0.1.2
|
17
17
|
|
18
18
|
# PyHw
|
19
19
|
[](https://pepy.tech/project/pyhw)
|
20
20
|

|
21
|
+

|
21
22
|
|
22
23
|

|
23
24
|

|
24
25
|

|
26
|
+

|
25
27
|
|
26
28
|

|
27
29
|

|
30
|
+

|
28
31
|
|
29
32
|
|
30
|
-
PyHw, a neofetch-like command line tool for fetching system information but written mostly in Python. **Currently, this project is still in the initial stage, only Linux, macOS, and
|
33
|
+
PyHw, a neofetch-like command line tool for fetching system information but written mostly in Python. **Currently, this project is still in the initial stage, only Linux, macOS, FreeBSD and Windows are supported.**
|
31
34
|
|
32
35
|
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 🤔).
|
33
36
|
|
@@ -94,8 +97,9 @@ This is due to the fact that system python is not supposed to be managed by pip.
|
|
94
97
|
|
95
98
|
## Tested OS
|
96
99
|
* macOS arm64, x86_64
|
97
|
-
* Linux arm64, x86_64
|
100
|
+
* Linux arm64, x86_64, riscv64
|
98
101
|
* FreeBSD arm64
|
102
|
+
* Windows 10 X86_64
|
99
103
|
|
100
104
|
## Add Logo
|
101
105
|
1. Create a file named **\<os>.pyhw** in **logo/ascii** folder
|