pyhw 0.2.0b0__tar.gz → 0.2.2b0__tar.gz
Sign up to get free protection for your applications and to get access to all the features.
- {pyhw-0.2.0b0/src/pyhw.egg-info → pyhw-0.2.2b0}/PKG-INFO +40 -2
- pyhw-0.2.2b0/README.md +72 -0
- {pyhw-0.2.0b0 → pyhw-0.2.2b0}/pyproject.toml +3 -1
- {pyhw-0.2.0b0 → pyhw-0.2.2b0}/src/pyhw/backend/cpu/linux.py +30 -0
- pyhw-0.2.2b0/src/pyhw/backend/host/linux.py +51 -0
- {pyhw-0.2.0b0 → pyhw-0.2.2b0}/src/pyhw/frontend/color/colorConfig.py +23 -1
- pyhw-0.2.2b0/src/pyhw/frontend/logo/ascii/armbian.pyhw +14 -0
- pyhw-0.2.2b0/src/pyhw/frontend/logo/ascii/raspbian.pyhw +23 -0
- {pyhw-0.2.0b0 → pyhw-0.2.2b0}/src/pyhw/pyhwUtil/pyhwUtil.py +11 -0
- {pyhw-0.2.0b0 → pyhw-0.2.2b0/src/pyhw.egg-info}/PKG-INFO +40 -2
- {pyhw-0.2.0b0 → pyhw-0.2.2b0}/src/pyhw.egg-info/SOURCES.txt +2 -0
- pyhw-0.2.0b0/README.md +0 -36
- pyhw-0.2.0b0/src/pyhw/backend/host/linux.py +0 -38
- {pyhw-0.2.0b0 → pyhw-0.2.2b0}/LICENSE +0 -0
- {pyhw-0.2.0b0 → pyhw-0.2.2b0}/MANIFEST.in +0 -0
- {pyhw-0.2.0b0 → pyhw-0.2.2b0}/setup.cfg +0 -0
- {pyhw-0.2.0b0 → pyhw-0.2.2b0}/src/pyhw/__init__.py +0 -0
- {pyhw-0.2.0b0 → pyhw-0.2.2b0}/src/pyhw/__main__.py +0 -0
- {pyhw-0.2.0b0 → pyhw-0.2.2b0}/src/pyhw/backend/__init__.py +0 -0
- {pyhw-0.2.0b0 → pyhw-0.2.2b0}/src/pyhw/backend/backendBase.py +0 -0
- {pyhw-0.2.0b0 → pyhw-0.2.2b0}/src/pyhw/backend/cpu/__init__.py +0 -0
- {pyhw-0.2.0b0 → pyhw-0.2.2b0}/src/pyhw/backend/cpu/cpuBase.py +0 -0
- {pyhw-0.2.0b0 → pyhw-0.2.2b0}/src/pyhw/backend/cpu/cpuInfo.py +0 -0
- {pyhw-0.2.0b0 → pyhw-0.2.2b0}/src/pyhw/backend/cpu/macos.py +0 -0
- {pyhw-0.2.0b0 → pyhw-0.2.2b0}/src/pyhw/backend/gpu/__init__.py +0 -0
- {pyhw-0.2.0b0 → pyhw-0.2.2b0}/src/pyhw/backend/gpu/gpuBase.py +0 -0
- {pyhw-0.2.0b0 → pyhw-0.2.2b0}/src/pyhw/backend/gpu/gpuInfo.py +0 -0
- {pyhw-0.2.0b0 → pyhw-0.2.2b0}/src/pyhw/backend/gpu/linux.py +0 -0
- {pyhw-0.2.0b0 → pyhw-0.2.2b0}/src/pyhw/backend/gpu/macos.py +0 -0
- {pyhw-0.2.0b0 → pyhw-0.2.2b0}/src/pyhw/backend/host/__init__.py +0 -0
- {pyhw-0.2.0b0 → pyhw-0.2.2b0}/src/pyhw/backend/host/hostBase.py +0 -0
- {pyhw-0.2.0b0 → pyhw-0.2.2b0}/src/pyhw/backend/host/hostInfo.py +0 -0
- {pyhw-0.2.0b0 → pyhw-0.2.2b0}/src/pyhw/backend/host/macos.py +0 -0
- {pyhw-0.2.0b0 → pyhw-0.2.2b0}/src/pyhw/backend/host/windows.py +0 -0
- {pyhw-0.2.0b0 → pyhw-0.2.2b0}/src/pyhw/backend/kernel/__init__.py +0 -0
- {pyhw-0.2.0b0 → pyhw-0.2.2b0}/src/pyhw/backend/kernel/kernelBase.py +0 -0
- {pyhw-0.2.0b0 → pyhw-0.2.2b0}/src/pyhw/backend/kernel/kernelInfo.py +0 -0
- {pyhw-0.2.0b0 → pyhw-0.2.2b0}/src/pyhw/backend/kernel/unix.py +0 -0
- {pyhw-0.2.0b0 → pyhw-0.2.2b0}/src/pyhw/backend/kernel/windows.py +0 -0
- {pyhw-0.2.0b0 → pyhw-0.2.2b0}/src/pyhw/backend/memory/__init__.py +0 -0
- {pyhw-0.2.0b0 → pyhw-0.2.2b0}/src/pyhw/backend/memory/linux.py +0 -0
- {pyhw-0.2.0b0 → pyhw-0.2.2b0}/src/pyhw/backend/memory/macos.py +0 -0
- {pyhw-0.2.0b0 → pyhw-0.2.2b0}/src/pyhw/backend/memory/memoryBase.py +0 -0
- {pyhw-0.2.0b0 → pyhw-0.2.2b0}/src/pyhw/backend/memory/memoryInfo.py +0 -0
- {pyhw-0.2.0b0 → pyhw-0.2.2b0}/src/pyhw/backend/metal/t.py +0 -0
- {pyhw-0.2.0b0 → pyhw-0.2.2b0}/src/pyhw/backend/os/__init__.py +0 -0
- {pyhw-0.2.0b0 → pyhw-0.2.2b0}/src/pyhw/backend/os/linux.py +0 -0
- {pyhw-0.2.0b0 → pyhw-0.2.2b0}/src/pyhw/backend/os/macos.py +0 -0
- {pyhw-0.2.0b0 → pyhw-0.2.2b0}/src/pyhw/backend/os/osBase.py +0 -0
- {pyhw-0.2.0b0 → pyhw-0.2.2b0}/src/pyhw/backend/os/osInfo.py +0 -0
- {pyhw-0.2.0b0 → pyhw-0.2.2b0}/src/pyhw/backend/shell/__init__.py +0 -0
- {pyhw-0.2.0b0 → pyhw-0.2.2b0}/src/pyhw/backend/shell/shellBase.py +0 -0
- {pyhw-0.2.0b0 → pyhw-0.2.2b0}/src/pyhw/backend/shell/unix.py +0 -0
- {pyhw-0.2.0b0 → pyhw-0.2.2b0}/src/pyhw/backend/title/__init__.py +0 -0
- {pyhw-0.2.0b0 → pyhw-0.2.2b0}/src/pyhw/backend/title/titleBase.py +0 -0
- {pyhw-0.2.0b0 → pyhw-0.2.2b0}/src/pyhw/backend/title/unix.py +0 -0
- {pyhw-0.2.0b0 → pyhw-0.2.2b0}/src/pyhw/backend/title/windows.py +0 -0
- {pyhw-0.2.0b0 → pyhw-0.2.2b0}/src/pyhw/backend/uptime/__init__.py +0 -0
- {pyhw-0.2.0b0 → pyhw-0.2.2b0}/src/pyhw/backend/uptime/linux.py +0 -0
- {pyhw-0.2.0b0 → pyhw-0.2.2b0}/src/pyhw/backend/uptime/macos.py +0 -0
- {pyhw-0.2.0b0 → pyhw-0.2.2b0}/src/pyhw/backend/uptime/uptimeBase.py +0 -0
- {pyhw-0.2.0b0 → pyhw-0.2.2b0}/src/pyhw/backend/uptime/uptimeInfo.py +0 -0
- {pyhw-0.2.0b0 → pyhw-0.2.2b0}/src/pyhw/frontend/__init__.py +0 -0
- {pyhw-0.2.0b0 → pyhw-0.2.2b0}/src/pyhw/frontend/color/__init__.py +0 -0
- {pyhw-0.2.0b0 → pyhw-0.2.2b0}/src/pyhw/frontend/color/colorSet.py +0 -0
- {pyhw-0.2.0b0 → pyhw-0.2.2b0}/src/pyhw/frontend/color/colorUtil.py +0 -0
- {pyhw-0.2.0b0 → pyhw-0.2.2b0}/src/pyhw/frontend/frontendBase.py +0 -0
- {pyhw-0.2.0b0 → pyhw-0.2.2b0}/src/pyhw/frontend/logo/__init__.py +0 -0
- {pyhw-0.2.0b0 → pyhw-0.2.2b0}/src/pyhw/frontend/logo/ascii/debian.pyhw +0 -0
- {pyhw-0.2.0b0 → pyhw-0.2.2b0}/src/pyhw/frontend/logo/ascii/fedora.pyhw +0 -0
- {pyhw-0.2.0b0 → pyhw-0.2.2b0}/src/pyhw/frontend/logo/ascii/fedora_small.pyhw +0 -0
- {pyhw-0.2.0b0 → pyhw-0.2.2b0}/src/pyhw/frontend/logo/ascii/linux.pyhw +0 -0
- {pyhw-0.2.0b0 → pyhw-0.2.2b0}/src/pyhw/frontend/logo/ascii/macOS.pyhw +0 -0
- {pyhw-0.2.0b0 → pyhw-0.2.2b0}/src/pyhw/frontend/logo/ascii/ubuntu.pyhw +0 -0
- {pyhw-0.2.0b0 → pyhw-0.2.2b0}/src/pyhw/frontend/logo/ascii/ubuntu_small.pyhw +0 -0
- {pyhw-0.2.0b0 → pyhw-0.2.2b0}/src/pyhw/frontend/logo/logoBase.py +0 -0
- {pyhw-0.2.0b0 → pyhw-0.2.2b0}/src/pyhw/macos.py +0 -0
- {pyhw-0.2.0b0 → pyhw-0.2.2b0}/src/pyhw/pyhwException/__init__.py +0 -0
- {pyhw-0.2.0b0 → pyhw-0.2.2b0}/src/pyhw/pyhwException/pyhwException.py +0 -0
- {pyhw-0.2.0b0 → pyhw-0.2.2b0}/src/pyhw/pyhwUtil/__init__.py +0 -0
- {pyhw-0.2.0b0 → pyhw-0.2.2b0}/src/pyhw/pyhwUtil/sysctlUtil.py +0 -0
- {pyhw-0.2.0b0 → pyhw-0.2.2b0}/src/pyhw.egg-info/dependency_links.txt +0 -0
- {pyhw-0.2.0b0 → pyhw-0.2.2b0}/src/pyhw.egg-info/entry_points.txt +0 -0
- {pyhw-0.2.0b0 → pyhw-0.2.2b0}/src/pyhw.egg-info/top_level.txt +0 -0
@@ -1,10 +1,12 @@
|
|
1
1
|
Metadata-Version: 2.1
|
2
2
|
Name: pyhw
|
3
|
-
Version: 0.2.
|
3
|
+
Version: 0.2.2b0
|
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
|
7
7
|
Project-URL: homepage, https://github.com/xiaoran007/pyhw
|
8
|
+
Keywords: neofetch,system information,command line tool,python,hardware information,fastfetch,fetching
|
9
|
+
Classifier: Development Status :: 4 - Beta
|
8
10
|
Classifier: Programming Language :: Python :: 3
|
9
11
|
Classifier: License :: OSI Approved :: BSD License
|
10
12
|
Classifier: Operating System :: OS Independent
|
@@ -16,20 +18,56 @@ License-File: LICENSE
|
|
16
18
|

|
17
19
|

|
18
20
|
|
21
|
+

|
22
|
+

|
19
23
|
|
20
24
|
|
21
25
|
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 part of the linux systems and macOS are supported.**
|
22
26
|
|
23
|
-
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 🤔)
|
27
|
+
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 🤔).
|
24
28
|
|
29
|
+
## Install
|
25
30
|
There are already a lot of similar tools so you can choose any of them; they're all essentially no different. If you want to try this tool, just install it directly by pip.
|
26
31
|
```shell
|
27
32
|
pip install pyhw
|
28
33
|
```
|
34
|
+
To upgrade pyhw:
|
35
|
+
```shell
|
36
|
+
pip install pyhw --upgrade
|
37
|
+
```
|
29
38
|
You can then use this tool directly from the command line with the following command, just like neofetch.
|
30
39
|
```shell
|
31
40
|
pyhw
|
32
41
|
```
|
42
|
+
Please note that the command line entry for __pyhw__ is created by pip, and depending on the user, this entry may not in the __system PATH__. If you encounter this problem, pip will give you a prompt, follow the prompts to add entry to the __system PATH__.
|
43
|
+
|
44
|
+
### Important note about debian 12:
|
45
|
+
If you use system pip to install pyhw, you will encounter this problem on debian12 and some related distributions:
|
46
|
+
```text
|
47
|
+
error: externally-managed-environment
|
48
|
+
|
49
|
+
× This environment is externally managed
|
50
|
+
╰─> To install Python packages system-wide, try apt install
|
51
|
+
python3-xyz, where xyz is the package you are trying to
|
52
|
+
install.
|
53
|
+
|
54
|
+
If you wish to install a non-Debian-packaged Python package,
|
55
|
+
create a virtual environment using python3 -m venv path/to/venv.
|
56
|
+
Then use path/to/venv/bin/python and path/to/venv/bin/pip. Make
|
57
|
+
sure you have python3-full installed.
|
58
|
+
|
59
|
+
For more information visit http://rptl.io/venv
|
60
|
+
|
61
|
+
note: If you believe this is a mistake, please contact your Python installation or OS distribution provider. You can override this, at the risk of breaking your Python installation or OS, by passing --break-system-packages.
|
62
|
+
hint: See PEP 668 for the detailed specification.
|
63
|
+
```
|
64
|
+
This is due to the fact that system python is not supposed to be managed by pip. You can use a virtual environment (venv) or force remove this restriction (not recommended).
|
65
|
+
|
66
|
+
## Supported (Tested) OS
|
67
|
+
* macOS arm64, x86_64
|
68
|
+
* debian-based distro x86_64
|
69
|
+
* RaspberryPi OS arm64
|
70
|
+
|
33
71
|
|
34
72
|
## Build from source
|
35
73
|
### Build tools
|
pyhw-0.2.2b0/README.md
ADDED
@@ -0,0 +1,72 @@
|
|
1
|
+
# PyHw
|
2
|
+

|
3
|
+

|
4
|
+
|
5
|
+

|
6
|
+

|
7
|
+
|
8
|
+
|
9
|
+
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 part of the linux systems and macOS are supported.**
|
10
|
+
|
11
|
+
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 🤔).
|
12
|
+
|
13
|
+
## Install
|
14
|
+
There are already a lot of similar tools so you can choose any of them; they're all essentially no different. If you want to try this tool, just install it directly by pip.
|
15
|
+
```shell
|
16
|
+
pip install pyhw
|
17
|
+
```
|
18
|
+
To upgrade pyhw:
|
19
|
+
```shell
|
20
|
+
pip install pyhw --upgrade
|
21
|
+
```
|
22
|
+
You can then use this tool directly from the command line with the following command, just like neofetch.
|
23
|
+
```shell
|
24
|
+
pyhw
|
25
|
+
```
|
26
|
+
Please note that the command line entry for __pyhw__ is created by pip, and depending on the user, this entry may not in the __system PATH__. If you encounter this problem, pip will give you a prompt, follow the prompts to add entry to the __system PATH__.
|
27
|
+
|
28
|
+
### Important note about debian 12:
|
29
|
+
If you use system pip to install pyhw, you will encounter this problem on debian12 and some related distributions:
|
30
|
+
```text
|
31
|
+
error: externally-managed-environment
|
32
|
+
|
33
|
+
× This environment is externally managed
|
34
|
+
╰─> To install Python packages system-wide, try apt install
|
35
|
+
python3-xyz, where xyz is the package you are trying to
|
36
|
+
install.
|
37
|
+
|
38
|
+
If you wish to install a non-Debian-packaged Python package,
|
39
|
+
create a virtual environment using python3 -m venv path/to/venv.
|
40
|
+
Then use path/to/venv/bin/python and path/to/venv/bin/pip. Make
|
41
|
+
sure you have python3-full installed.
|
42
|
+
|
43
|
+
For more information visit http://rptl.io/venv
|
44
|
+
|
45
|
+
note: If you believe this is a mistake, please contact your Python installation or OS distribution provider. You can override this, at the risk of breaking your Python installation or OS, by passing --break-system-packages.
|
46
|
+
hint: See PEP 668 for the detailed specification.
|
47
|
+
```
|
48
|
+
This is due to the fact that system python is not supposed to be managed by pip. You can use a virtual environment (venv) or force remove this restriction (not recommended).
|
49
|
+
|
50
|
+
## Supported (Tested) OS
|
51
|
+
* macOS arm64, x86_64
|
52
|
+
* debian-based distro x86_64
|
53
|
+
* RaspberryPi OS arm64
|
54
|
+
|
55
|
+
|
56
|
+
## Build from source
|
57
|
+
### Build tools
|
58
|
+
Make sure the following Python build tools are already installed.
|
59
|
+
* setuptools
|
60
|
+
* build
|
61
|
+
* twine
|
62
|
+
|
63
|
+
### Build package
|
64
|
+
clone the project, and run:
|
65
|
+
```shell
|
66
|
+
python -m build
|
67
|
+
```
|
68
|
+
or you can use the old setup.py style command:
|
69
|
+
```shell
|
70
|
+
python setup.py sdist bdist_wheel
|
71
|
+
```
|
72
|
+
After the build process, the source package and the binary whl package can be found in the dist folder.
|
@@ -4,8 +4,9 @@ build-backend = "setuptools.build_meta"
|
|
4
4
|
|
5
5
|
[project]
|
6
6
|
name = "pyhw"
|
7
|
-
version = "0.2.
|
7
|
+
version = "0.2.2b"
|
8
8
|
description = "PyHw, a neofetch-like command line tool for fetching system information but written mostly in python."
|
9
|
+
keywords = ["neofetch", "system information", "command line tool", "python", "hardware information", "fastfetch", "fetching"]
|
9
10
|
authors = [
|
10
11
|
{ name = "Xiao Ran", email = "xiaoran.007@icloud.com" }
|
11
12
|
]
|
@@ -13,6 +14,7 @@ readme = "README.md"
|
|
13
14
|
license = {text = "BSD-3-Clause"}
|
14
15
|
requires-python = ">=3.9"
|
15
16
|
classifiers = [
|
17
|
+
"Development Status :: 4 - Beta",
|
16
18
|
"Programming Language :: Python :: 3",
|
17
19
|
"License :: OSI Approved :: BSD License",
|
18
20
|
"Operating System :: OS Independent"
|
@@ -10,6 +10,9 @@ class CPUDetectLinux:
|
|
10
10
|
def getCPUInfo(self):
|
11
11
|
self.__getCPUInfo()
|
12
12
|
self.__modelClean()
|
13
|
+
self.__handleSBC()
|
14
|
+
if self.__cpuInfo.model == "":
|
15
|
+
self.__cpuInfo.model = "Unknown"
|
13
16
|
if self.__cpuInfo.model != "":
|
14
17
|
self.__cpuInfo.cpu = self.__cpuInfo.model
|
15
18
|
if self.__cpuInfo.cores != "":
|
@@ -51,3 +54,30 @@ class CPUDetectLinux:
|
|
51
54
|
def __modelClean(self):
|
52
55
|
self.__cpuInfo.model = self.__cpuInfo.model.replace("(R)", "")
|
53
56
|
self.__cpuInfo.model = self.__cpuInfo.model.replace("(TM)", "")
|
57
|
+
|
58
|
+
def __handleSBC(self):
|
59
|
+
# some values should be double-checked
|
60
|
+
# Info source: https://github.com/raspberrypi/firmware/tree/master/boot
|
61
|
+
raspberry_pi_soc_map = {
|
62
|
+
"Raspberry Pi 2 Model B Rev 1.1": "BCM2836",
|
63
|
+
"Raspberry Pi 2 Model B Rev 1.2": "BCM2837",
|
64
|
+
"Raspberry Pi 3 Model B": "BCM2837",
|
65
|
+
"Raspberry Pi 3 Model B+": "BCM2837",
|
66
|
+
"Raspberry Pi 4 Model B": "BCM2711",
|
67
|
+
"Raspberry Pi 5": "BCM2712",
|
68
|
+
}
|
69
|
+
if os.path.exists("/sys/firmware/devicetree/base/model"):
|
70
|
+
try:
|
71
|
+
with open("/sys/firmware/devicetree/base/model", "r") as f:
|
72
|
+
model = f.read().strip()
|
73
|
+
except FileNotFoundError:
|
74
|
+
model = ""
|
75
|
+
if "Raspberry Pi" in model:
|
76
|
+
map_cpu = raspberry_pi_soc_map.get(model, "Unknown")
|
77
|
+
if map_cpu != "Unknown":
|
78
|
+
self.__cpuInfo.model = map_cpu
|
79
|
+
else:
|
80
|
+
pass
|
81
|
+
else:
|
82
|
+
pass
|
83
|
+
|
@@ -0,0 +1,51 @@
|
|
1
|
+
"""
|
2
|
+
In dev.
|
3
|
+
"""
|
4
|
+
from ...pyhwUtil import getArch
|
5
|
+
from .hostInfo import HostInfo
|
6
|
+
import os
|
7
|
+
|
8
|
+
|
9
|
+
class HostDetectLinux:
|
10
|
+
def __init__(self):
|
11
|
+
self.__hostInfo = HostInfo()
|
12
|
+
self.__arch = getArch()
|
13
|
+
|
14
|
+
def getHostInfo(self):
|
15
|
+
self.__getModel()
|
16
|
+
return self.__hostInfo
|
17
|
+
|
18
|
+
def __getModel(self):
|
19
|
+
if self.__arch in ["x86_64", "x86"]:
|
20
|
+
try:
|
21
|
+
with open("/sys/devices/virtual/dmi/id/product_name", "r") as f:
|
22
|
+
self.__hostInfo.name = f.read().strip()
|
23
|
+
with open("/sys/devices/virtual/dmi/id/product_version", "r") as f:
|
24
|
+
self.__hostInfo.version = f.read().strip()
|
25
|
+
self.__hostInfo.model = self.__hostInfo.name + " " + self.__hostInfo.version
|
26
|
+
except FileNotFoundError:
|
27
|
+
pass
|
28
|
+
elif self.__arch in ["aarch64", "arm32"]:
|
29
|
+
# try to find dmi folder since some arm based desktops and servers may have same structure as x86_64 machines.
|
30
|
+
if os.path.exists("/sys/devices/virtual/dmi/id"):
|
31
|
+
try:
|
32
|
+
with open("/sys/devices/virtual/dmi/id/product_name", "r") as f:
|
33
|
+
self.__hostInfo.name = f.read().strip()
|
34
|
+
with open("/sys/devices/virtual/dmi/id/product_version", "r") as f:
|
35
|
+
self.__hostInfo.version = f.read().strip()
|
36
|
+
self.__hostInfo.model = self.__hostInfo.name + " " + self.__hostInfo.version
|
37
|
+
except FileNotFoundError:
|
38
|
+
pass
|
39
|
+
else:
|
40
|
+
# some single board computers may not have dmi folder, try to find model name in device tree.
|
41
|
+
try:
|
42
|
+
with open("/sys/firmware/devicetree/base/model", "r") as f:
|
43
|
+
self.__hostInfo.model = f.read().strip()
|
44
|
+
except FileNotFoundError:
|
45
|
+
pass
|
46
|
+
|
47
|
+
def __getHostFamily(self):
|
48
|
+
pass
|
49
|
+
|
50
|
+
def __getHostProductName(self):
|
51
|
+
pass
|
@@ -21,13 +21,23 @@ class ColorConfigSet:
|
|
21
21
|
return ColorConfigSetU.ubuntu
|
22
22
|
elif self.__os_name == "ubuntu_small":
|
23
23
|
return ColorConfigSetU.ubuntu_small
|
24
|
+
elif self.__os_name == "raspbian":
|
25
|
+
return ColorConfigSetR.raspbian
|
26
|
+
elif self.__os_name == "armbian":
|
27
|
+
return ColorConfigSetA.armbian
|
24
28
|
else:
|
25
29
|
return ColorConfigSetL.linux # default to Linux
|
26
30
|
|
27
31
|
|
28
32
|
@dataclass
|
29
33
|
class ColorConfigSetA:
|
30
|
-
|
34
|
+
armbian = {
|
35
|
+
"colors": [
|
36
|
+
ColorSet.COLOR_FG_RED
|
37
|
+
],
|
38
|
+
"colorKeys": ColorSet.COLOR_FG_YELLOW,
|
39
|
+
"colorTitle": ColorSet.COLOR_FG_YELLOW
|
40
|
+
}
|
31
41
|
|
32
42
|
|
33
43
|
@dataclass
|
@@ -90,6 +100,18 @@ class ColorConfigSetM:
|
|
90
100
|
}
|
91
101
|
|
92
102
|
|
103
|
+
@dataclass
|
104
|
+
class ColorConfigSetR:
|
105
|
+
raspbian = {
|
106
|
+
"colors": [
|
107
|
+
ColorSet.COLOR_FG_RED,
|
108
|
+
ColorSet.COLOR_FG_GREEN
|
109
|
+
],
|
110
|
+
"colorKeys": ColorSet.COLOR_FG_RED,
|
111
|
+
"colorTitle": ColorSet.COLOR_FG_GREEN
|
112
|
+
}
|
113
|
+
|
114
|
+
|
93
115
|
@dataclass
|
94
116
|
class ColorConfigSetU:
|
95
117
|
ubuntu = {
|
@@ -0,0 +1,14 @@
|
|
1
|
+
█ █ █ █ █ █ █ █ █ █ █
|
2
|
+
███████████████████████
|
3
|
+
▄▄██ ██▄▄
|
4
|
+
▄▄██ ███████████ ██▄▄
|
5
|
+
▄▄██ ██ ██ ██▄▄
|
6
|
+
▄▄██ ██ ██ ██▄▄
|
7
|
+
▄▄██ ██ ██ ██▄▄
|
8
|
+
▄▄██ █████████████ ██▄▄
|
9
|
+
▄▄██ ██ ██ ██▄▄
|
10
|
+
▄▄██ ██ ██ ██▄▄
|
11
|
+
▄▄██ ██ ██ ██▄▄
|
12
|
+
▄▄██ ██▄▄
|
13
|
+
███████████████████████
|
14
|
+
█ █ █ █ █ █ █ █ █ █ █
|
@@ -0,0 +1,23 @@
|
|
1
|
+
$2`.::///+:/-. --///+//-:`
|
2
|
+
`+oooooooooooo: `+oooooooooooo:
|
3
|
+
/oooo++//ooooo: ooooo+//+ooooo.
|
4
|
+
`+ooooooo:-:oo- +o+::/ooooooo:
|
5
|
+
`:oooooooo+`` `.oooooooo+-
|
6
|
+
`:++ooo/. :+ooo+/.`$1
|
7
|
+
...` `.----.` ``..
|
8
|
+
.::::-``:::::::::.`-:::-`
|
9
|
+
-:::-` .:::::::-` `-:::-
|
10
|
+
`::. `.--.` `` `.---.``.::`
|
11
|
+
.::::::::` -::::::::` `
|
12
|
+
.::` .:::::::::- `::::::::::``::.
|
13
|
+
-:::` ::::::::::. ::::::::::.`:::-
|
14
|
+
:::: -::::::::. `-:::::::: ::::
|
15
|
+
-::- .-:::-.``....``.-::-. -::-
|
16
|
+
.. `` .::::::::. `..`..
|
17
|
+
-:::-` -::::::::::` .:::::`
|
18
|
+
:::::::` -::::::::::` :::::::.
|
19
|
+
.::::::: -::::::::. ::::::::
|
20
|
+
`-:::::` ..--.` ::::::.
|
21
|
+
`...` `...--..` `...`
|
22
|
+
.::::::::::
|
23
|
+
`.-::::-`
|
@@ -1,6 +1,7 @@
|
|
1
1
|
import platform
|
2
2
|
from ..backend import Data
|
3
3
|
import os
|
4
|
+
from dataclasses import dataclass
|
4
5
|
|
5
6
|
|
6
7
|
def getOS():
|
@@ -53,6 +54,12 @@ def createDataString(data: Data):
|
|
53
54
|
return data_string
|
54
55
|
|
55
56
|
|
57
|
+
@dataclass
|
58
|
+
class SupportedOS:
|
59
|
+
ColorConfig = ["armbian", "debian", "fedora", "macOS", "raspbian", "ubuntu"]
|
60
|
+
AsciiLogo = ["armbian", "debian", "fedora", "macOS", "raspbian", "ubuntu"]
|
61
|
+
|
62
|
+
|
56
63
|
def selectOSLogo(os_id: str):
|
57
64
|
"""
|
58
65
|
Select the logo based on the os id and terminal size.
|
@@ -61,6 +68,10 @@ def selectOSLogo(os_id: str):
|
|
61
68
|
"""
|
62
69
|
if getOS() == "macos":
|
63
70
|
return os_id
|
71
|
+
if os_id in SupportedOS.ColorConfig and os_id in SupportedOS.AsciiLogo:
|
72
|
+
pass
|
73
|
+
else:
|
74
|
+
return "linux"
|
64
75
|
rows_str, columns_str = os.popen('stty size', 'r').read().split()
|
65
76
|
rows = int(rows_str)
|
66
77
|
columns = int(columns_str)
|
@@ -1,10 +1,12 @@
|
|
1
1
|
Metadata-Version: 2.1
|
2
2
|
Name: pyhw
|
3
|
-
Version: 0.2.
|
3
|
+
Version: 0.2.2b0
|
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
|
7
7
|
Project-URL: homepage, https://github.com/xiaoran007/pyhw
|
8
|
+
Keywords: neofetch,system information,command line tool,python,hardware information,fastfetch,fetching
|
9
|
+
Classifier: Development Status :: 4 - Beta
|
8
10
|
Classifier: Programming Language :: Python :: 3
|
9
11
|
Classifier: License :: OSI Approved :: BSD License
|
10
12
|
Classifier: Operating System :: OS Independent
|
@@ -16,20 +18,56 @@ License-File: LICENSE
|
|
16
18
|

|
17
19
|

|
18
20
|
|
21
|
+

|
22
|
+

|
19
23
|
|
20
24
|
|
21
25
|
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 part of the linux systems and macOS are supported.**
|
22
26
|
|
23
|
-
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 🤔)
|
27
|
+
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 🤔).
|
24
28
|
|
29
|
+
## Install
|
25
30
|
There are already a lot of similar tools so you can choose any of them; they're all essentially no different. If you want to try this tool, just install it directly by pip.
|
26
31
|
```shell
|
27
32
|
pip install pyhw
|
28
33
|
```
|
34
|
+
To upgrade pyhw:
|
35
|
+
```shell
|
36
|
+
pip install pyhw --upgrade
|
37
|
+
```
|
29
38
|
You can then use this tool directly from the command line with the following command, just like neofetch.
|
30
39
|
```shell
|
31
40
|
pyhw
|
32
41
|
```
|
42
|
+
Please note that the command line entry for __pyhw__ is created by pip, and depending on the user, this entry may not in the __system PATH__. If you encounter this problem, pip will give you a prompt, follow the prompts to add entry to the __system PATH__.
|
43
|
+
|
44
|
+
### Important note about debian 12:
|
45
|
+
If you use system pip to install pyhw, you will encounter this problem on debian12 and some related distributions:
|
46
|
+
```text
|
47
|
+
error: externally-managed-environment
|
48
|
+
|
49
|
+
× This environment is externally managed
|
50
|
+
╰─> To install Python packages system-wide, try apt install
|
51
|
+
python3-xyz, where xyz is the package you are trying to
|
52
|
+
install.
|
53
|
+
|
54
|
+
If you wish to install a non-Debian-packaged Python package,
|
55
|
+
create a virtual environment using python3 -m venv path/to/venv.
|
56
|
+
Then use path/to/venv/bin/python and path/to/venv/bin/pip. Make
|
57
|
+
sure you have python3-full installed.
|
58
|
+
|
59
|
+
For more information visit http://rptl.io/venv
|
60
|
+
|
61
|
+
note: If you believe this is a mistake, please contact your Python installation or OS distribution provider. You can override this, at the risk of breaking your Python installation or OS, by passing --break-system-packages.
|
62
|
+
hint: See PEP 668 for the detailed specification.
|
63
|
+
```
|
64
|
+
This is due to the fact that system python is not supposed to be managed by pip. You can use a virtual environment (venv) or force remove this restriction (not recommended).
|
65
|
+
|
66
|
+
## Supported (Tested) OS
|
67
|
+
* macOS arm64, x86_64
|
68
|
+
* debian-based distro x86_64
|
69
|
+
* RaspberryPi OS arm64
|
70
|
+
|
33
71
|
|
34
72
|
## Build from source
|
35
73
|
### Build tools
|
@@ -64,11 +64,13 @@ src/pyhw/frontend/color/colorSet.py
|
|
64
64
|
src/pyhw/frontend/color/colorUtil.py
|
65
65
|
src/pyhw/frontend/logo/__init__.py
|
66
66
|
src/pyhw/frontend/logo/logoBase.py
|
67
|
+
src/pyhw/frontend/logo/ascii/armbian.pyhw
|
67
68
|
src/pyhw/frontend/logo/ascii/debian.pyhw
|
68
69
|
src/pyhw/frontend/logo/ascii/fedora.pyhw
|
69
70
|
src/pyhw/frontend/logo/ascii/fedora_small.pyhw
|
70
71
|
src/pyhw/frontend/logo/ascii/linux.pyhw
|
71
72
|
src/pyhw/frontend/logo/ascii/macOS.pyhw
|
73
|
+
src/pyhw/frontend/logo/ascii/raspbian.pyhw
|
72
74
|
src/pyhw/frontend/logo/ascii/ubuntu.pyhw
|
73
75
|
src/pyhw/frontend/logo/ascii/ubuntu_small.pyhw
|
74
76
|
src/pyhw/pyhwException/__init__.py
|
pyhw-0.2.0b0/README.md
DELETED
@@ -1,36 +0,0 @@
|
|
1
|
-
# PyHw
|
2
|
-

|
3
|
-

|
4
|
-
|
5
|
-
|
6
|
-
|
7
|
-
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 part of the linux systems and macOS are supported.**
|
8
|
-
|
9
|
-
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 🤔)
|
10
|
-
|
11
|
-
There are already a lot of similar tools so you can choose any of them; they're all essentially no different. If you want to try this tool, just install it directly by pip.
|
12
|
-
```shell
|
13
|
-
pip install pyhw
|
14
|
-
```
|
15
|
-
You can then use this tool directly from the command line with the following command, just like neofetch.
|
16
|
-
```shell
|
17
|
-
pyhw
|
18
|
-
```
|
19
|
-
|
20
|
-
## Build from source
|
21
|
-
### Build tools
|
22
|
-
Make sure the following Python build tools are already installed.
|
23
|
-
* setuptools
|
24
|
-
* build
|
25
|
-
* twine
|
26
|
-
|
27
|
-
### Build package
|
28
|
-
clone the project, and run:
|
29
|
-
```shell
|
30
|
-
python -m build
|
31
|
-
```
|
32
|
-
or you can use the old setup.py style command:
|
33
|
-
```shell
|
34
|
-
python setup.py sdist bdist_wheel
|
35
|
-
```
|
36
|
-
After the build process, the source package and the binary whl package can be found in the dist folder.
|
@@ -1,38 +0,0 @@
|
|
1
|
-
"""
|
2
|
-
In dev.
|
3
|
-
"""
|
4
|
-
from ...pyhwUtil import getArch
|
5
|
-
from .hostInfo import HostInfo
|
6
|
-
|
7
|
-
|
8
|
-
class HostDetectLinux:
|
9
|
-
def __init__(self):
|
10
|
-
self.__hostInfo = HostInfo()
|
11
|
-
self.__arch = getArch()
|
12
|
-
|
13
|
-
def getHostInfo(self):
|
14
|
-
self.__getModel()
|
15
|
-
return self.__hostInfo
|
16
|
-
|
17
|
-
def __getModel(self):
|
18
|
-
if self.__arch in ["x86_64", "x86"]:
|
19
|
-
try:
|
20
|
-
with open("/sys/devices/virtual/dmi/id/product_name", "r") as f:
|
21
|
-
self.__hostInfo.name = f.read().strip()
|
22
|
-
with open("/sys/devices/virtual/dmi/id/product_version", "r") as f:
|
23
|
-
self.__hostInfo.version = f.read().strip()
|
24
|
-
self.__hostInfo.model = self.__hostInfo.name + " " + self.__hostInfo.version
|
25
|
-
except FileNotFoundError:
|
26
|
-
pass
|
27
|
-
elif self.__arch in ["aarch64", "arm32"]:
|
28
|
-
try:
|
29
|
-
with open("/sys/firmware/devicetree/base/model", "r") as f:
|
30
|
-
self.__hostInfo.model = f.read().strip()
|
31
|
-
except FileNotFoundError:
|
32
|
-
pass
|
33
|
-
|
34
|
-
def __getHostFamily(self):
|
35
|
-
pass
|
36
|
-
|
37
|
-
def __getHostProductName(self):
|
38
|
-
pass
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|