1
0
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:
Daniel Mach 2025-01-03 13:51:21 +01:00 committed by GitHub
commit d0d6965472
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -13,6 +13,7 @@ from typing import Optional
try:
import progressbar as pb
have_pb_module = True
using_pb_progressbar2 = tuple(map(int, pb.__version__.split('.'))) >= (3, 1)
except ImportError:
have_pb_module = False
@ -62,9 +63,14 @@ class PBTextMeter(TextMeterBase):
for i in self.bar.widgets:
if not isinstance(i, pb.Bar):
continue
i.marker = " "
i.left = " "
i.right = " "
if using_pb_progressbar2:
i.marker = lambda _progress, _data, _width: " "
i.left = lambda _progress, _data, _width: " "
i.right = lambda _progress, _data, _width: " "
else:
i.marker = " "
i.left = " "
i.right = " "
self.bar.finish()