Add macOS support (#27)

Co-authored-by: Maddie <maddie@spyhoodle.me>
This commit is contained in:
alexia 2023-07-17 23:53:19 +02:00 committed by GitHub
parent ec82eb613c
commit f9f9b94d67
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 5 additions and 3 deletions

View File

@ -24,7 +24,7 @@ Originally forked from [megabytesofrem/pridefetch](https://github.com/megabyteso
## Quickstart ## Quickstart
**Requirements:** `Python 3.7` or higher and `python-distro` **Requirements:** `Python 3.7` or higher, `python-distro` and `python-psutil`
```bash ```bash
git clone https://github.com/SpyHoodle/pridefetch.git git clone https://github.com/SpyHoodle/pridefetch.git
cd pridefetch/src cd pridefetch/src

View File

@ -14,7 +14,8 @@ from socket import gethostname
# System info modules # System info modules
from platform import platform as system from platform import platform as system
from platform import release as kernel from platform import release as kernel
from time import clock_gettime, CLOCK_BOOTTIME from time import time
from psutil import boot_time
from platform import machine as architecture from platform import machine as architecture
from distro import name as distribution from distro import name as distribution
from modules.packages import get_num_packages as packages from modules.packages import get_num_packages as packages
@ -45,7 +46,7 @@ stats = {
"arch": lambda: architecture() or 'N/A', "arch": lambda: architecture() or 'N/A',
"pkgs": lambda: packages() or 'N/A', "pkgs": lambda: packages() or 'N/A',
"kernel": lambda: kernel() or system() or 'N/A', "kernel": lambda: kernel() or system() or 'N/A',
"uptime": lambda: str(timedelta(seconds=clock_gettime(CLOCK_BOOTTIME))).split('.', 1)[0] "uptime": lambda: str(timedelta(seconds=time() - boot_time())).split('.', 1)[0]
} }

View File

@ -12,6 +12,7 @@ class PackagesCommand:
packages_commands: list[PackagesCommand] = [ packages_commands: list[PackagesCommand] = [
PackagesCommand("pacman -Qq --color never"), # Arch Linux PackagesCommand("pacman -Qq --color never"), # Arch Linux
PackagesCommand("brew list"), # macOS
PackagesCommand("dpkg-query -f '.\n' -W"), # Debian, Ubuntu, Mint PackagesCommand("dpkg-query -f '.\n' -W"), # Debian, Ubuntu, Mint
PackagesCommand("dnf list installed -q", -1), # Fedora, RHEL PackagesCommand("dnf list installed -q", -1), # Fedora, RHEL
PackagesCommand("yum list installed -q", -1), # RHEL, Fedora Core, CentOS PackagesCommand("yum list installed -q", -1), # RHEL, Fedora Core, CentOS