mirror of
https://github.com/SpyHoodle/PrideFetch.git
synced 2024-09-19 22:55:43 +01:00
21 lines
462 B
Python
21 lines
462 B
Python
from subprocess import check_output
|
|
|
|
commands = [
|
|
"pacman -Qq",
|
|
"apt list --installed",
|
|
"yum list installed",
|
|
"dnf list installed",
|
|
"qlist -I",
|
|
"nix profile list",
|
|
"nix-env -q",
|
|
"rpm -qa",
|
|
]
|
|
|
|
def get_num_packages() -> (int, bool):
|
|
for command in commands:
|
|
try:
|
|
return len(check_output(command.split(" ")).decode("utf-8").split("\n")) - 1
|
|
except FileNotFoundError:
|
|
pass
|
|
return False
|