Clean this up a little.
This commit is contained in:
parent
f65a6b7fa6
commit
4dafefc081
@ -43,16 +43,14 @@ VERSION_TEMPL = "%s=%s"
|
||||
class AptPackager(pack.Packager):
|
||||
def __init__(self, distro):
|
||||
pack.Packager.__init__(self, distro)
|
||||
|
||||
def _format_version(self, name, version):
|
||||
return VERSION_TEMPL % (name, version)
|
||||
self.auto_remove = True
|
||||
|
||||
def _format_pkg(self, name, version):
|
||||
if version and len(version):
|
||||
cmd = self._format_version(name, version)
|
||||
if version:
|
||||
pkg_full_name = VERSION_TEMPL % (name, version)
|
||||
else:
|
||||
cmd = name
|
||||
return cmd
|
||||
pkg_full_name = name
|
||||
return pkg_full_name
|
||||
|
||||
def _execute_apt(self, cmd, **kargs):
|
||||
return sh.execute(*cmd, run_as_root=True,
|
||||
@ -80,9 +78,10 @@ class AptPackager(pack.Packager):
|
||||
if cmds:
|
||||
cmd = APT_GET + APT_DO_REMOVE + cmds
|
||||
self._execute_apt(cmd)
|
||||
#clean them out
|
||||
cmd = APT_GET + APT_AUTOREMOVE
|
||||
self._execute_apt(cmd)
|
||||
#clean them out (if we did anything)
|
||||
if which_removed and self.auto_remove:
|
||||
cmd = APT_GET + APT_AUTOREMOVE
|
||||
self._execute_apt(cmd)
|
||||
return which_removed
|
||||
|
||||
def install_batch(self, pkgs):
|
||||
|
Loading…
x
Reference in New Issue
Block a user