mirror of
https://github.com/openSUSE/osc.git
synced 2025-02-22 18:22:12 +01:00
Merge pull request #1680 from scottp-dpaw/progress_fix
Fix progress bar code to support progressbar2
This commit is contained in:
commit
d0d6965472
12
osc/meter.py
12
osc/meter.py
@ -13,6 +13,7 @@ from typing import Optional
|
|||||||
try:
|
try:
|
||||||
import progressbar as pb
|
import progressbar as pb
|
||||||
have_pb_module = True
|
have_pb_module = True
|
||||||
|
using_pb_progressbar2 = tuple(map(int, pb.__version__.split('.'))) >= (3, 1)
|
||||||
except ImportError:
|
except ImportError:
|
||||||
have_pb_module = False
|
have_pb_module = False
|
||||||
|
|
||||||
@ -62,9 +63,14 @@ class PBTextMeter(TextMeterBase):
|
|||||||
for i in self.bar.widgets:
|
for i in self.bar.widgets:
|
||||||
if not isinstance(i, pb.Bar):
|
if not isinstance(i, pb.Bar):
|
||||||
continue
|
continue
|
||||||
i.marker = " "
|
if using_pb_progressbar2:
|
||||||
i.left = " "
|
i.marker = lambda _progress, _data, _width: " "
|
||||||
i.right = " "
|
i.left = lambda _progress, _data, _width: " "
|
||||||
|
i.right = lambda _progress, _data, _width: " "
|
||||||
|
else:
|
||||||
|
i.marker = " "
|
||||||
|
i.left = " "
|
||||||
|
i.right = " "
|
||||||
|
|
||||||
self.bar.finish()
|
self.bar.finish()
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user