package.py -> command.py

a
This commit is contained in:
2025-06-11 16:24:51 -04:00
parent 478e40c4e3
commit 97e3348bd4
2 changed files with 5 additions and 4 deletions

14
src/command.py Normal file
View File

@ -0,0 +1,14 @@
import subprocess
from typing import Optional
def package_installed(package_name: str) -> Optional[bool]:
try:
installed = subprocess.run(["dpkg", "-s", package_name], stdout=subprocess.PIPE, stderr=subprocess.PIPE).returncode == 0
if not installed:
print(f"Package \"{package_name}\" not installed.")
return installed
except Exception as err:
print(err)
return None