From a44dc28cdf0a48cf3858b59950132df7f7b8b057 Mon Sep 17 00:00:00 2001 From: Michael Hansen Date: Tue, 16 Jan 2024 16:08:05 -0600 Subject: [PATCH] Fix requirements --- installer/packages.py | 23 ++++++++++++++++++----- requirements.txt | 2 +- 2 files changed, 19 insertions(+), 6 deletions(-) diff --git a/installer/packages.py b/installer/packages.py index 02252ec..1e3bacd 100644 --- a/installer/packages.py +++ b/installer/packages.py @@ -1,14 +1,21 @@ """Install system packages.""" +import logging import subprocess from .const import PROGRAM_DIR from .whiptail import run_with_gauge +_LOGGER = logging.getLogger() + def packages_installed(*packages) -> bool: for package in packages: try: - subprocess.check_call(["dpkg", "--status", str(package)]) + subprocess.check_call( + ["dpkg", "--status", str(package)], + stdout=subprocess.DEVNULL, + stderr=subprocess.DEVNULL, + ) except Exception: 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] ) - for command in commands: - subprocess.check_call( - command, stdout=subprocess.DEVNULL, stderr=subprocess.DEVNULL - ) + try: + for command in commands: + 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( diff --git a/requirements.txt b/requirements.txt index 88027b9..63600a7 100644 --- a/requirements.txt +++ b/requirements.txt @@ -1,3 +1,3 @@ -wyoming==1.4.2 +wyoming==1.5.0 zeroconf==0.88.0 pyring-buffer==1.0.0