Use reverse bar on uninstalls...
This commit is contained in:
parent
a714aae75d
commit
a2fc6a8c2d
@ -405,7 +405,7 @@ class PkgUninstallComponent(ComponentBase):
|
|||||||
LOG.info("Potentially removing %s packages (%s)",
|
LOG.info("Potentially removing %s packages (%s)",
|
||||||
len(pkg_names), ", ".join(pkg_names))
|
len(pkg_names), ", ".join(pkg_names))
|
||||||
which_removed = set()
|
which_removed = set()
|
||||||
with utils.progress_bar(UNINSTALL_TITLE, len(pkgs)) as p_bar:
|
with utils.progress_bar(UNINSTALL_TITLE, len(pkgs), reverse=True) as p_bar:
|
||||||
for (i, p) in enumerate(pkgs):
|
for (i, p) in enumerate(pkgs):
|
||||||
if self.packager.remove(p):
|
if self.packager.remove(p):
|
||||||
which_removed.add(p['name'])
|
which_removed.add(p['name'])
|
||||||
@ -452,7 +452,7 @@ class PythonUninstallComponent(PkgUninstallComponent):
|
|||||||
if pips:
|
if pips:
|
||||||
names = set([p['name'] for p in pips])
|
names = set([p['name'] for p in pips])
|
||||||
LOG.info("Uninstalling %s python packages (%s)" % (len(names), ", ".join(names)))
|
LOG.info("Uninstalling %s python packages (%s)" % (len(names), ", ".join(names)))
|
||||||
with utils.progress_bar(UNINSTALL_TITLE, len(pips)) as p_bar:
|
with utils.progress_bar(UNINSTALL_TITLE, len(pips), reverse=True) as p_bar:
|
||||||
for (i, p) in enumerate(pips):
|
for (i, p) in enumerate(pips):
|
||||||
pip.uninstall(p, self.distro)
|
pip.uninstall(p, self.distro)
|
||||||
p_bar.update(i + 1)
|
p_bar.update(i + 1)
|
||||||
|
@ -142,12 +142,17 @@ def to_bytes(text):
|
|||||||
|
|
||||||
|
|
||||||
@contextlib.contextmanager
|
@contextlib.contextmanager
|
||||||
def progress_bar(name, max_am):
|
def progress_bar(name, max_am, reverse=False):
|
||||||
widgets = [
|
widgets = list()
|
||||||
'%s: ' % (name), progressbar.Percentage(),
|
widgets.append('%s: ' % (name))
|
||||||
' ', progressbar.Bar(),
|
widgets.append(progressbar.Percentage())
|
||||||
' ', progressbar.ETA(),
|
widgets.append(' ')
|
||||||
]
|
if reverse:
|
||||||
|
widgets.append(progressbar.ReverseBar())
|
||||||
|
else:
|
||||||
|
widgets.append(progressbar.Bar())
|
||||||
|
widgets.append(' ')
|
||||||
|
widgets.append(progressbar.ETA())
|
||||||
p_bar = progressbar.ProgressBar(maxval=max_am, widgets=widgets)
|
p_bar = progressbar.ProgressBar(maxval=max_am, widgets=widgets)
|
||||||
p_bar.start()
|
p_bar.start()
|
||||||
try:
|
try:
|
||||||
|
Loading…
x
Reference in New Issue
Block a user