jw.pkg.cmds.distro.backend.*.Base -> Util
Rename the class Base of all distribution backends to Util. It contains distribution specifics, but is not going to be the base class anymore shortly. Signed-off-by: Jan Lindemann <jan@janware.com>
This commit is contained in:
parent
2cc3b59e75
commit
05f3f33931
16 changed files with 28 additions and 28 deletions
|
|
@ -3,9 +3,9 @@
|
||||||
from argparse import Namespace
|
from argparse import Namespace
|
||||||
|
|
||||||
from ...Cmd import Cmd
|
from ...Cmd import Cmd
|
||||||
from .Base import Base
|
from .Util import Util
|
||||||
|
|
||||||
class Dup(Base):
|
class Dup(Util):
|
||||||
|
|
||||||
def __init__(self, parent: Cmd):
|
def __init__(self, parent: Cmd):
|
||||||
super().__init__(parent)
|
super().__init__(parent)
|
||||||
|
|
|
||||||
|
|
@ -3,9 +3,9 @@
|
||||||
from argparse import Namespace
|
from argparse import Namespace
|
||||||
|
|
||||||
from ...Cmd import Cmd
|
from ...Cmd import Cmd
|
||||||
from .Base import Base
|
from .Util import Util
|
||||||
|
|
||||||
class Install(Base):
|
class Install(Util):
|
||||||
|
|
||||||
def __init__(self, parent: Cmd):
|
def __init__(self, parent: Cmd):
|
||||||
super().__init__(parent)
|
super().__init__(parent)
|
||||||
|
|
|
||||||
|
|
@ -3,9 +3,9 @@
|
||||||
from argparse import Namespace
|
from argparse import Namespace
|
||||||
|
|
||||||
from ...Cmd import Cmd
|
from ...Cmd import Cmd
|
||||||
from .Base import Base
|
from .Util import Util
|
||||||
|
|
||||||
class Refresh(Base):
|
class Refresh(Util):
|
||||||
|
|
||||||
def __init__(self, parent: Cmd):
|
def __init__(self, parent: Cmd):
|
||||||
super().__init__(parent)
|
super().__init__(parent)
|
||||||
|
|
|
||||||
16
src/python/jw/pkg/cmds/distro/backend/arch/Util.py
Normal file
16
src/python/jw/pkg/cmds/distro/backend/arch/Util.py
Normal file
|
|
@ -0,0 +1,16 @@
|
||||||
|
# -*- coding: utf-8 -*-
|
||||||
|
|
||||||
|
from ...Cmd import Cmd
|
||||||
|
from ..Backend import Backend
|
||||||
|
|
||||||
|
class Util(Backend):
|
||||||
|
|
||||||
|
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)
|
||||||
|
|
@ -3,9 +3,9 @@
|
||||||
from argparse import Namespace
|
from argparse import Namespace
|
||||||
|
|
||||||
from ...Cmd import Cmd
|
from ...Cmd import Cmd
|
||||||
from .Base import Base
|
from .Util import Util
|
||||||
|
|
||||||
class Dup(Base):
|
class Dup(Util):
|
||||||
|
|
||||||
def __init__(self, parent: Cmd):
|
def __init__(self, parent: Cmd):
|
||||||
super().__init__(parent)
|
super().__init__(parent)
|
||||||
|
|
|
||||||
|
|
@ -3,9 +3,9 @@
|
||||||
from argparse import Namespace
|
from argparse import Namespace
|
||||||
|
|
||||||
from ...Cmd import Cmd
|
from ...Cmd import Cmd
|
||||||
from .Base import Base
|
from .Util import Util
|
||||||
|
|
||||||
class Install(Base):
|
class Install(Util):
|
||||||
|
|
||||||
def __init__(self, parent: Cmd):
|
def __init__(self, parent: Cmd):
|
||||||
super().__init__(parent)
|
super().__init__(parent)
|
||||||
|
|
|
||||||
|
|
@ -3,9 +3,9 @@
|
||||||
from argparse import Namespace
|
from argparse import Namespace
|
||||||
|
|
||||||
from ...Cmd import Cmd
|
from ...Cmd import Cmd
|
||||||
from .Base import Base
|
from .Util import Util
|
||||||
|
|
||||||
class Refresh(Base):
|
class Refresh(Util):
|
||||||
|
|
||||||
def __init__(self, parent: Cmd):
|
def __init__(self, parent: Cmd):
|
||||||
super().__init__(parent)
|
super().__init__(parent)
|
||||||
|
|
|
||||||
18
src/python/jw/pkg/cmds/distro/backend/debian/Util.py
Normal file
18
src/python/jw/pkg/cmds/distro/backend/debian/Util.py
Normal file
|
|
@ -0,0 +1,18 @@
|
||||||
|
# -*- coding: utf-8 -*-
|
||||||
|
|
||||||
|
from ...Cmd import Cmd
|
||||||
|
from ..Backend import Backend
|
||||||
|
|
||||||
|
class Util(Backend):
|
||||||
|
|
||||||
|
def __init__(self, parent: Cmd):
|
||||||
|
super().__init__(parent)
|
||||||
|
|
||||||
|
async def apt_get(self, *args):
|
||||||
|
cmd = ['/usr/bin/apt-get']
|
||||||
|
mod_env = None
|
||||||
|
if not self.interactive:
|
||||||
|
cmd.extend(['-yes', '--quiet', '--fix-broken'])
|
||||||
|
mod_env = { 'DEBIAN_FRONTEND': 'noninteractive' }
|
||||||
|
cmd.extend(args)
|
||||||
|
return await self._sudo(cmd, mod_env=mod_env)
|
||||||
|
|
@ -3,9 +3,9 @@
|
||||||
from argparse import Namespace
|
from argparse import Namespace
|
||||||
|
|
||||||
from ...Cmd import Cmd
|
from ...Cmd import Cmd
|
||||||
from .Base import Base
|
from .Util import Util
|
||||||
|
|
||||||
class Dup(Base):
|
class Dup(Util):
|
||||||
|
|
||||||
def __init__(self, parent: Cmd):
|
def __init__(self, parent: Cmd):
|
||||||
super().__init__(parent)
|
super().__init__(parent)
|
||||||
|
|
|
||||||
|
|
@ -3,9 +3,9 @@
|
||||||
from argparse import Namespace
|
from argparse import Namespace
|
||||||
|
|
||||||
from ...Cmd import Cmd
|
from ...Cmd import Cmd
|
||||||
from .Base import Base
|
from .Util import Util
|
||||||
|
|
||||||
class Install(Base):
|
class Install(Util):
|
||||||
|
|
||||||
def __init__(self, parent: Cmd):
|
def __init__(self, parent: Cmd):
|
||||||
super().__init__(parent)
|
super().__init__(parent)
|
||||||
|
|
|
||||||
|
|
@ -3,9 +3,9 @@
|
||||||
from argparse import Namespace
|
from argparse import Namespace
|
||||||
|
|
||||||
from ...Cmd import Cmd
|
from ...Cmd import Cmd
|
||||||
from .Base import Base
|
from .Util import Util
|
||||||
|
|
||||||
class Refresh(Base):
|
class Refresh(Util):
|
||||||
|
|
||||||
def __init__(self, parent: Cmd):
|
def __init__(self, parent: Cmd):
|
||||||
super().__init__(parent)
|
super().__init__(parent)
|
||||||
|
|
|
||||||
14
src/python/jw/pkg/cmds/distro/backend/redhat/Util.py
Normal file
14
src/python/jw/pkg/cmds/distro/backend/redhat/Util.py
Normal file
|
|
@ -0,0 +1,14 @@
|
||||||
|
# -*- coding: utf-8 -*-
|
||||||
|
|
||||||
|
from ...Cmd import Cmd
|
||||||
|
from ..Backend import Backend
|
||||||
|
|
||||||
|
class Util(Backend):
|
||||||
|
|
||||||
|
def __init__(self, parent: Cmd):
|
||||||
|
super().__init__(parent)
|
||||||
|
|
||||||
|
async def yum(self, *args):
|
||||||
|
cmd = ['/usr/bin/yum']
|
||||||
|
cmd.extend(args)
|
||||||
|
return await self._sudo(cmd)
|
||||||
|
|
@ -3,9 +3,9 @@
|
||||||
from argparse import Namespace
|
from argparse import Namespace
|
||||||
|
|
||||||
from ...Cmd import Cmd
|
from ...Cmd import Cmd
|
||||||
from .Base import Base
|
from .Util import Util
|
||||||
|
|
||||||
class Dup(Base):
|
class Dup(Util):
|
||||||
|
|
||||||
def __init__(self, parent: Cmd):
|
def __init__(self, parent: Cmd):
|
||||||
super().__init__(parent)
|
super().__init__(parent)
|
||||||
|
|
|
||||||
|
|
@ -3,9 +3,9 @@
|
||||||
from argparse import Namespace
|
from argparse import Namespace
|
||||||
|
|
||||||
from ...Cmd import Cmd
|
from ...Cmd import Cmd
|
||||||
from .Base import Base
|
from .Util import Util
|
||||||
|
|
||||||
class Install(Base):
|
class Install(Util):
|
||||||
|
|
||||||
def __init__(self, parent: Cmd):
|
def __init__(self, parent: Cmd):
|
||||||
super().__init__(parent)
|
super().__init__(parent)
|
||||||
|
|
|
||||||
|
|
@ -3,9 +3,9 @@
|
||||||
from argparse import Namespace
|
from argparse import Namespace
|
||||||
|
|
||||||
from ...Cmd import Cmd
|
from ...Cmd import Cmd
|
||||||
from .Base import Base
|
from .Util import Util
|
||||||
|
|
||||||
class Refresh(Base):
|
class Refresh(Util):
|
||||||
|
|
||||||
def __init__(self, parent: Cmd):
|
def __init__(self, parent: Cmd):
|
||||||
super().__init__(parent)
|
super().__init__(parent)
|
||||||
|
|
|
||||||
17
src/python/jw/pkg/cmds/distro/backend/suse/Util.py
Normal file
17
src/python/jw/pkg/cmds/distro/backend/suse/Util.py
Normal file
|
|
@ -0,0 +1,17 @@
|
||||||
|
# -*- coding: utf-8 -*-
|
||||||
|
|
||||||
|
from ...Cmd import Cmd
|
||||||
|
from ..Backend import Backend
|
||||||
|
|
||||||
|
class Util(Backend):
|
||||||
|
|
||||||
|
def __init__(self, parent: Cmd):
|
||||||
|
super().__init__(parent)
|
||||||
|
|
||||||
|
async def zypper(self, *args):
|
||||||
|
cmd = ['/usr/bin/zypper']
|
||||||
|
if not self.interactive:
|
||||||
|
cmd.extend(['--non-interactive', '--gpg-auto-import-keys', '--no-gpg-checks'])
|
||||||
|
cmd.extend(args)
|
||||||
|
# Run sudo --login in case /etc/profile modifies ZYPP_CONF
|
||||||
|
return await self._sudo(cmd, opts=['--login'])
|
||||||
Loading…
Reference in a new issue