From 10c0e5fcad9509a11467c746c4e785537732935e Mon Sep 17 00:00:00 2001 From: Fabio Manganiello Date: Sun, 20 Aug 2023 21:21:37 +0200 Subject: [PATCH] Added default_os field to PackageManagers enum elements. This is useful to determine which is the default set of scripts that should be used by the installer depending on the detected installed package manager. --- platypush/install/scripts/arch/PKGCMD | 2 +- platypush/utils/manifest.py | 10 +++++++++- 2 files changed, 10 insertions(+), 2 deletions(-) diff --git a/platypush/install/scripts/arch/PKGCMD b/platypush/install/scripts/arch/PKGCMD index 6d32b41e..eb711b62 100644 --- a/platypush/install/scripts/arch/PKGCMD +++ b/platypush/install/scripts/arch/PKGCMD @@ -1 +1 @@ -pacman -S --noconfirm +pacman -S --noconfirm --needed diff --git a/platypush/utils/manifest.py b/platypush/utils/manifest.py index 0ab2ed80..f8aef8a3 100644 --- a/platypush/utils/manifest.py +++ b/platypush/utils/manifest.py @@ -55,6 +55,11 @@ class PackageManager: executable: str """ The executable name. """ + default_os: str + """ + The default distro whose configuration we should use if this package + manager is detected. + """ install: Iterable[str] = field(default_factory=tuple) """ The install command, as a sequence of strings. """ uninstall: Iterable[str] = field(default_factory=tuple) @@ -70,18 +75,21 @@ class PackageManagers(Enum): executable='apk', install=('apk', 'add', '--update', '--no-interactive', '--no-cache'), uninstall=('apk', 'del', '--no-interactive'), + default_os='alpine', ) APT = PackageManager( executable='apt', install=('apt', 'install', '-y'), uninstall=('apt', 'remove', '-y'), + default_os='debian', ) PACMAN = PackageManager( executable='pacman', - install=('pacman', '-S', '--noconfirm'), + install=('pacman', '-S', '--noconfirm', '--needed'), uninstall=('pacman', '-R', '--noconfirm'), + default_os='arch', ) @classmethod