forked from platypush/platypush
PackageManager
has both install
and uninstall
.
This commit is contained in:
parent
5efcae64c1
commit
a6f8021150
2 changed files with 13 additions and 7 deletions
|
@ -6,6 +6,7 @@ WORKDIR /var/lib/platypush
|
||||||
ARG DOCKER_CTX=1
|
ARG DOCKER_CTX=1
|
||||||
ENV DOCKER_CTX=1
|
ENV DOCKER_CTX=1
|
||||||
|
|
||||||
|
RUN apk update
|
||||||
RUN /install/platypush/install/scripts/alpine/install.sh
|
RUN /install/platypush/install/scripts/alpine/install.sh
|
||||||
RUN cd /install && pip install -U --no-input --no-cache-dir .
|
RUN cd /install && pip install -U --no-input --no-cache-dir .
|
||||||
RUN rm -rf /install
|
RUN rm -rf /install
|
||||||
|
|
|
@ -55,8 +55,10 @@ class PackageManager:
|
||||||
|
|
||||||
executable: str
|
executable: str
|
||||||
""" The executable name. """
|
""" The executable name. """
|
||||||
command: Iterable[str] = field(default_factory=tuple)
|
install: Iterable[str] = field(default_factory=tuple)
|
||||||
""" The command to execute, as a sequence of strings. """
|
""" The install command, as a sequence of strings. """
|
||||||
|
uninstall: Iterable[str] = field(default_factory=tuple)
|
||||||
|
""" The uninstall command, as a sequence of strings. """
|
||||||
|
|
||||||
|
|
||||||
class PackageManagers(Enum):
|
class PackageManagers(Enum):
|
||||||
|
@ -66,17 +68,20 @@ class PackageManagers(Enum):
|
||||||
|
|
||||||
APK = PackageManager(
|
APK = PackageManager(
|
||||||
executable='apk',
|
executable='apk',
|
||||||
command=('apk', 'add', '--update', '--no-interactive', '--no-cache'),
|
install=('apk', 'add', '--update', '--no-interactive', '--no-cache'),
|
||||||
|
uninstall=('apk', 'del', '--no-interactive'),
|
||||||
)
|
)
|
||||||
|
|
||||||
APT = PackageManager(
|
APT = PackageManager(
|
||||||
executable='apt',
|
executable='apt',
|
||||||
command=('apt', 'install', '-y'),
|
install=('apt', 'install', '-y'),
|
||||||
|
uninstall=('apt', 'remove', '-y'),
|
||||||
)
|
)
|
||||||
|
|
||||||
PACMAN = PackageManager(
|
PACMAN = PackageManager(
|
||||||
executable='pacman',
|
executable='pacman',
|
||||||
command=('pacman', '-S', '--noconfirm'),
|
install=('pacman', '-S', '--noconfirm'),
|
||||||
|
uninstall=('pacman', '-R', '--noconfirm'),
|
||||||
)
|
)
|
||||||
|
|
||||||
@classmethod
|
@classmethod
|
||||||
|
@ -90,7 +95,7 @@ class PackageManagers(Enum):
|
||||||
if not pkg_manager:
|
if not pkg_manager:
|
||||||
raise ValueError(f'Unknown package manager: {name}')
|
raise ValueError(f'Unknown package manager: {name}')
|
||||||
|
|
||||||
return pkg_manager.value.command
|
return pkg_manager.value.install
|
||||||
|
|
||||||
@classmethod
|
@classmethod
|
||||||
def scan(cls) -> Optional["PackageManagers"]:
|
def scan(cls) -> Optional["PackageManagers"]:
|
||||||
|
@ -221,7 +226,7 @@ class Dependencies:
|
||||||
yield ' '.join(
|
yield ' '.join(
|
||||||
[
|
[
|
||||||
*(['sudo'] if wants_sudo else []),
|
*(['sudo'] if wants_sudo else []),
|
||||||
*pkg_manager.value.command,
|
*pkg_manager.value.install,
|
||||||
*sorted(self.packages), # type: ignore
|
*sorted(self.packages), # type: ignore
|
||||||
]
|
]
|
||||||
)
|
)
|
||||||
|
|
Loading…
Reference in a new issue