diff --git a/CHANGELOG.md b/CHANGELOG.md index bab076e..5dccd38 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -5,6 +5,18 @@ 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 + +- purge email settings for wuttjamaican also + ## v0.4.4 (2024-10-03) ### Fix diff --git a/pyproject.toml b/pyproject.toml index 1138238..b023bf6 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -6,7 +6,7 @@ build-backend = "hatchling.build" [project] name = "rattail-fabric2" -version = "0.4.4" +version = "0.4.6" description = "Fabric (v2) Utilities for Rattail" readme = "README.md" authors = [{name = "Lance Edgar", email = "lance@edbob.org"}] 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 diff --git a/rattail_fabric2/rattail.py b/rattail_fabric2/rattail.py index 2c59994..3094cf7 100644 --- a/rattail_fabric2/rattail.py +++ b/rattail_fabric2/rattail.py @@ -108,6 +108,14 @@ def delete_email_recipients(c, dbname): """ Purge all email recipient settings for the given database. """ + # purge new-style for wuttjamaican + postgresql.sql(c, "delete from setting where name like 'rattail.email.%.sender';", database=dbname) + postgresql.sql(c, "delete from setting where name like 'rattail.email.%.to';", database=dbname) + postgresql.sql(c, "delete from setting where name like 'rattail.email.%.cc';", database=dbname) + postgresql.sql(c, "delete from setting where name like 'rattail.email.%.bcc';", database=dbname) + + # purge old-style for rattail + postgresql.sql(c, "delete from setting where name like 'rattail.mail.%.from';", database=dbname) postgresql.sql(c, "delete from setting where name like 'rattail.mail.%.to';", database=dbname) postgresql.sql(c, "delete from setting where name like 'rattail.mail.%.cc';", database=dbname) postgresql.sql(c, "delete from setting where name like 'rattail.mail.%.bcc';", database=dbname)