diff options
Diffstat (limited to 'bitbake/lib/progressbar/progressbar.py')
| -rw-r--r-- | bitbake/lib/progressbar/progressbar.py | 16 |
1 files changed, 12 insertions, 4 deletions
diff --git a/bitbake/lib/progressbar/progressbar.py b/bitbake/lib/progressbar/progressbar.py index 0b9dcf763e..2873ad6cae 100644 --- a/bitbake/lib/progressbar/progressbar.py +++ b/bitbake/lib/progressbar/progressbar.py | |||
| @@ -3,6 +3,8 @@ | |||
| 3 | # progressbar - Text progress bar library for Python. | 3 | # progressbar - Text progress bar library for Python. |
| 4 | # Copyright (c) 2005 Nilton Volpato | 4 | # Copyright (c) 2005 Nilton Volpato |
| 5 | # | 5 | # |
| 6 | # (With some small changes after importing into BitBake) | ||
| 7 | # | ||
| 6 | # This library is free software; you can redistribute it and/or | 8 | # This library is free software; you can redistribute it and/or |
| 7 | # modify it under the terms of the GNU Lesser General Public | 9 | # modify it under the terms of the GNU Lesser General Public |
| 8 | # License as published by the Free Software Foundation; either | 10 | # License as published by the Free Software Foundation; either |
| @@ -261,12 +263,14 @@ class ProgressBar(object): | |||
| 261 | now = time.time() | 263 | now = time.time() |
| 262 | self.seconds_elapsed = now - self.start_time | 264 | self.seconds_elapsed = now - self.start_time |
| 263 | self.next_update = self.currval + self.update_interval | 265 | self.next_update = self.currval + self.update_interval |
| 264 | self.fd.write(self._format_line() + '\r') | 266 | output = self._format_line() |
| 267 | self.fd.write(output + '\r') | ||
| 265 | self.fd.flush() | 268 | self.fd.flush() |
| 266 | self.last_update_time = now | 269 | self.last_update_time = now |
| 270 | return output | ||
| 267 | 271 | ||
| 268 | 272 | ||
| 269 | def start(self): | 273 | def start(self, update=True): |
| 270 | """Starts measuring time, and prints the bar at 0%. | 274 | """Starts measuring time, and prints the bar at 0%. |
| 271 | 275 | ||
| 272 | It returns self so you can use it like this: | 276 | It returns self so you can use it like this: |
| @@ -289,8 +293,12 @@ class ProgressBar(object): | |||
| 289 | self.update_interval = self.maxval / self.num_intervals | 293 | self.update_interval = self.maxval / self.num_intervals |
| 290 | 294 | ||
| 291 | 295 | ||
| 292 | self.start_time = self.last_update_time = time.time() | 296 | self.start_time = time.time() |
| 293 | self.update(0) | 297 | if update: |
| 298 | self.last_update_time = self.start_time | ||
| 299 | self.update(0) | ||
| 300 | else: | ||
| 301 | self.last_update_time = 0 | ||
| 294 | 302 | ||
| 295 | return self | 303 | return self |
| 296 | 304 | ||
