diff mbox series

progressbar: Make bars show correctly with maxval == 0

Message ID 20251011042310.2260617-1-pkj@axis.com
State New
Headers show
Series progressbar: Make bars show correctly with maxval == 0 | expand

Commit Message

Peter Kjellerstedt Oct. 11, 2025, 4:23 a.m. UTC
While it can be argued how useful a progressbar created with 0 as
maximum value is, it should still show two states, started (empty) and
finished (full). Setting the maxval to _DEFAULT_MAXVAL instead will
accomplish this.

Signed-off-by: Peter Kjellerstedt <peter.kjellerstedt@axis.com>
---

This solves an additional problem related to the progress bars that I
noticed. This typically happens when the dependency cache is empty.

 bitbake/lib/progressbar/progressbar.py | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
diff mbox series

Patch

diff --git a/bitbake/lib/progressbar/progressbar.py b/bitbake/lib/progressbar/progressbar.py
index eccc45849b..a8e2dc09c9 100644
--- a/bitbake/lib/progressbar/progressbar.py
+++ b/bitbake/lib/progressbar/progressbar.py
@@ -106,7 +106,7 @@  class ProgressBar(object):
         if widgets is None:
             widgets = list(self._DEFAULT_WIDGETS)
 
-        self.maxval = maxval
+        self.maxval = maxval if maxval != 0 else self._DEFAULT_MAXVAL
         self.widgets = widgets
         self.fd = fd
         self.left_justify = left_justify