From 47ec0c67ca07efe718f9a4940f3301020dbf1bf0 Mon Sep 17 00:00:00 2001 From: Lance Edgar Date: Sat, 6 Sep 2025 16:29:11 -0500 Subject: [PATCH 1/2] fix: add `apt.is_installed()` function --- rattail_fabric2/apt.py | 15 ++++++++++++++- 1 file changed, 14 insertions(+), 1 deletion(-) diff --git a/rattail_fabric2/apt.py b/rattail_fabric2/apt.py index e685c5a..1dd8014 100644 --- a/rattail_fabric2/apt.py +++ b/rattail_fabric2/apt.py @@ -2,7 +2,7 @@ ################################################################################ # # Rattail -- Retail Software Framework -# Copyright © 2010-2018 Lance Edgar +# Copyright © 2010-2025 Lance Edgar # # This file is part of Rattail. # @@ -44,6 +44,19 @@ def install(c, *packages, **kwargs): frontend, target, force_yes, ' '.join(packages)), **kwargs) +def is_installed(c, package): + """ + Check if the given APT package is installed. + + :param c: Fabric connection. + + :param package: Name of package to be checked. + + :returns: ``True`` if package is installed, else ``False``. + """ + return c.run(f"dpkg-query -s {package}", warn=True).ok + + def purge(c, *packages): """ Uninstall and purge config for given packages From 94c170f9f74dd89f2f2d8ff0d58242218364b542 Mon Sep 17 00:00:00 2001 From: Lance Edgar Date: Sat, 6 Sep 2025 16:33:07 -0500 Subject: [PATCH 2/2] =?UTF-8?q?bump:=20version=200.4.5=20=E2=86=92=200.4.6?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- CHANGELOG.md | 6 ++++++ pyproject.toml | 2 +- 2 files changed, 7 insertions(+), 1 deletion(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 08bc6ae..5dccd38 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -5,6 +5,12 @@ All notable changes to rattail-fabric2 will be documented in this file. The format is based on [Keep a Changelog](http://keepachangelog.com/en/1.0.0/) and this project adheres to [Semantic Versioning](http://semver.org/spec/v2.0.0.html). +## v0.4.6 (2025-09-06) + +### Fix + +- add `apt.is_installed()` function + ## v0.4.5 (2025-02-01) ### Fix diff --git a/pyproject.toml b/pyproject.toml index cad4da6..b023bf6 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -6,7 +6,7 @@ build-backend = "hatchling.build" [project] name = "rattail-fabric2" -version = "0.4.5" +version = "0.4.6" description = "Fabric (v2) Utilities for Rattail" readme = "README.md" authors = [{name = "Lance Edgar", email = "lance@edbob.org"}]