[PATCHv3,3/4] knotty.py: A little clean up of TerminalFilter::updateFooter()

Message ID 20220308143233.19972-3-pkj@axis.com
State Accepted, archived
Commit 160f71372ff93894d9314619e9d3b547c1f3cda3
Headers show
Series [PATCHv3,1/4] knotty.py: Improve the message while waiting for running tasks to finish | expand

Commit Message

Peter Kjellerstedt March 8, 2022, 2:32 p.m. UTC
* Use max() to clamp progress to >= 0.
* Be consistent when evaluating self.quiet (treat it as a boolean).

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

PATCHv3: New. This was previously part of the preceding patch.

 bitbake/lib/bb/ui/knotty.py | 6 ++----
 1 file changed, 2 insertions(+), 4 deletions(-)

Patch

diff --git a/bitbake/lib/bb/ui/knotty.py b/bitbake/lib/bb/ui/knotty.py
index 52e6eb96fe..78888f8bdd 100644
--- a/bitbake/lib/bb/ui/knotty.py
+++ b/bitbake/lib/bb/ui/knotty.py
@@ -299,13 +299,11 @@  class TerminalFilter(object):
                 self.main_progress = BBProgress("Running tasks", maxtask, widgets=widgets, resize_handler=self.sigwinch_handle)
                 self.main_progress.start(False)
             self.main_progress.setmessage(msg)
-            progress = self.helper.tasknumber_current - 1
-            if progress < 0:
-                progress = 0
+            progress = max(0, self.helper.tasknumber_current - 1)
             content += self.main_progress.update(progress)
             print('')
         lines = self.getlines(content)
-        if self.quiet == 0:
+        if not self.quiet:
             for tasknum, task in enumerate(tasks[:(self.rows - 1 - lines)]):
                 if isinstance(task, tuple):
                     pbar, progress, rate, start_time = task