diff --git a/src/python/jw/pkg/cmds/distro/backend/arch/Base.py b/src/python/jw/pkg/cmds/distro/backend/arch/Base.py new file mode 100644 index 00000000..5b88c243 --- /dev/null +++ b/src/python/jw/pkg/cmds/distro/backend/arch/Base.py @@ -0,0 +1,16 @@ +# -*- coding: utf-8 -*- + +from ...Cmd import Cmd +from ..BackendCmd import BackendCmd + +class Base(BackendCmd): + + def __init__(self, parent: Cmd): + super().__init__(parent) + + async def pacman(self, *args): + cmd = ['/usr/bin/pacman'] + if not self.interactive: + cmd.extend(['--noconfirm']) + cmd.extend(args) + return await self._sudo(cmd) diff --git a/src/python/jw/pkg/cmds/distro/backend/arch/Dup.py b/src/python/jw/pkg/cmds/distro/backend/arch/Dup.py new file mode 100644 index 00000000..124473cc --- /dev/null +++ b/src/python/jw/pkg/cmds/distro/backend/arch/Dup.py @@ -0,0 +1,14 @@ +# -*- coding: utf-8 -*- + +from argparse import Namespace + +from ...Cmd import Cmd +from .Base import Base + +class Dup(Base): + + def __init__(self, parent: Cmd): + super().__init__(parent) + + async def run(self, args: Namespace): + raise NotImplementedError('distro dup is not yet implemented for Arch-like distributions') diff --git a/src/python/jw/pkg/cmds/distro/backend/arch/Install.py b/src/python/jw/pkg/cmds/distro/backend/arch/Install.py new file mode 100644 index 00000000..51b99d05 --- /dev/null +++ b/src/python/jw/pkg/cmds/distro/backend/arch/Install.py @@ -0,0 +1,16 @@ +# -*- coding: utf-8 -*- + +from argparse import Namespace + +from ...Cmd import Cmd +from .Base import Base + +class Install(Base): + + def __init__(self, parent: Cmd): + super().__init__(parent) + + async def run(self, args: Namespace): + pacman_args = ['-S', '--needed'] + pacman_args.extend(args.packages) + await self.pacman(*pacman_args) diff --git a/src/python/jw/pkg/cmds/distro/backend/arch/Makefile b/src/python/jw/pkg/cmds/distro/backend/arch/Makefile new file mode 100644 index 00000000..d8d0e64b --- /dev/null +++ b/src/python/jw/pkg/cmds/distro/backend/arch/Makefile @@ -0,0 +1,4 @@ +TOPDIR = ../../../../../../../.. + +include $(TOPDIR)/make/proj.mk +include $(JWBDIR)/make/py-mod.mk diff --git a/src/python/jw/pkg/cmds/distro/backend/arch/Refresh.py b/src/python/jw/pkg/cmds/distro/backend/arch/Refresh.py new file mode 100644 index 00000000..92af0569 --- /dev/null +++ b/src/python/jw/pkg/cmds/distro/backend/arch/Refresh.py @@ -0,0 +1,14 @@ +# -*- coding: utf-8 -*- + +from argparse import Namespace + +from ...Cmd import Cmd +from .Base import Base + +class Refresh(Base): + + def __init__(self, parent: Cmd): + super().__init__(parent) + + async def run(self, args: Namespace): + raise NotImplementedError('distro refresh is not yet implemented for Arch-like distributions')