Fix requirements

This commit is contained in:
Michael Hansen
2024-01-16 17:06:30 -06:00
parent f198e28d80
commit a44dc28cdf
2 changed files with 19 additions and 6 deletions
+18 -5
View File
@@ -1,14 +1,21 @@
"""Install system packages.""" """Install system packages."""
import logging
import subprocess import subprocess
from .const import PROGRAM_DIR from .const import PROGRAM_DIR
from .whiptail import run_with_gauge from .whiptail import run_with_gauge
_LOGGER = logging.getLogger()
def packages_installed(*packages) -> bool: def packages_installed(*packages) -> bool:
for package in packages: for package in packages:
try: try:
subprocess.check_call(["dpkg", "--status", str(package)]) subprocess.check_call(
["dpkg", "--status", str(package)],
stdout=subprocess.DEVNULL,
stderr=subprocess.DEVNULL,
)
except Exception: except Exception:
return False return False
@@ -26,10 +33,16 @@ def install_packages_nogui(*packages, update: bool = True) -> bool:
["sudo", "apt-get", "install", "--yes"] + [str(p) for p in packages] ["sudo", "apt-get", "install", "--yes"] + [str(p) for p in packages]
) )
for command in commands: try:
subprocess.check_call( for command in commands:
command, stdout=subprocess.DEVNULL, stderr=subprocess.DEVNULL subprocess.check_call(
) command, stdout=subprocess.DEVNULL, stderr=subprocess.DEVNULL
)
except Exception:
_LOGGER.exception("Unexpected error installing packages: %s", packages)
return False
return True
def install_packages( def install_packages(
+1 -1
View File
@@ -1,3 +1,3 @@
wyoming==1.4.2 wyoming==1.5.0
zeroconf==0.88.0 zeroconf==0.88.0
pyring-buffer==1.0.0 pyring-buffer==1.0.0