[bitbake-devel,v3,2/4] progress: fix hypothetical NameError if 'progress' isn't set

Submitted by Chris Laplante via lists.openembedded.org on July 31, 2020, 3:42 p.m. | Patch ID: 174962

Details

Message ID 20200731154249.89999-3-chris.laplante@agilent.com
State New
Headers show

Commit Message

Signed-off-by: Chris Laplante <chris.laplante@agilent.com>
---
 lib/bb/progress.py | 8 +++++---
 1 file changed, 5 insertions(+), 3 deletions(-)

Patch hide | download patch | download mbox

diff --git a/lib/bb/progress.py b/lib/bb/progress.py
index b4e9bf0f..8cddefae 100644
--- a/lib/bb/progress.py
+++ b/lib/bb/progress.py
@@ -204,6 +204,7 @@  class MultiStageProgressReporter:
           value is considered to be out of stage_total, otherwise it should
           be a percentage value from 0 to 100.
         """
+        progress = None
         if self._stage_total:
             stage_progress = (float(stage_progress) / self._stage_total) * 100
         if self._stage < 0:
@@ -212,9 +213,10 @@  class MultiStageProgressReporter:
             progress = self._base_progress + (stage_progress * self._stage_weights[self._stage])
         else:
             progress = self._base_progress
-        if progress > 100:
-            progress = 100
-        self._fire_progress(progress)
+        if progress:
+            if progress > 100:
+                progress = 100
+            self._fire_progress(progress)
 
     def finish(self):
         if self._finished: