diff options
Diffstat (limited to 'bitbake/lib/bb/progress.py')
| -rw-r--r-- | bitbake/lib/bb/progress.py | 16 |
1 files changed, 15 insertions, 1 deletions
diff --git a/bitbake/lib/bb/progress.py b/bitbake/lib/bb/progress.py index e9b72e28b9..4022caa717 100644 --- a/bitbake/lib/bb/progress.py +++ b/bitbake/lib/bb/progress.py | |||
| @@ -13,6 +13,7 @@ import time | |||
| 13 | import inspect | 13 | import inspect |
| 14 | import bb.event | 14 | import bb.event |
| 15 | import bb.build | 15 | import bb.build |
| 16 | from bb.build import StdoutNoopContextManager | ||
| 16 | 17 | ||
| 17 | class ProgressHandler(object): | 18 | class ProgressHandler(object): |
| 18 | """ | 19 | """ |
| @@ -27,7 +28,14 @@ class ProgressHandler(object): | |||
| 27 | if outfile: | 28 | if outfile: |
| 28 | self._outfile = outfile | 29 | self._outfile = outfile |
| 29 | else: | 30 | else: |
| 30 | self._outfile = sys.stdout | 31 | self._outfile = StdoutNoopContextManager() |
| 32 | |||
| 33 | def __enter__(self): | ||
| 34 | self._outfile.__enter__() | ||
| 35 | return self | ||
| 36 | |||
| 37 | def __exit__(self, *excinfo): | ||
| 38 | self._outfile.__exit__(*excinfo) | ||
| 31 | 39 | ||
| 32 | def _fire_progress(self, taskprogress, rate=None): | 40 | def _fire_progress(self, taskprogress, rate=None): |
| 33 | """Internal function to fire the progress event""" | 41 | """Internal function to fire the progress event""" |
| @@ -147,6 +155,12 @@ class MultiStageProgressReporter(object): | |||
| 147 | self._stage_total = None | 155 | self._stage_total = None |
| 148 | self._callers = [] | 156 | self._callers = [] |
| 149 | 157 | ||
| 158 | def __enter__(self): | ||
| 159 | return self | ||
| 160 | |||
| 161 | def __exit__(self, *excinfo): | ||
| 162 | pass | ||
| 163 | |||
| 150 | def _fire_progress(self, taskprogress): | 164 | def _fire_progress(self, taskprogress): |
| 151 | bb.event.fire(bb.build.TaskProgress(taskprogress), self._data) | 165 | bb.event.fire(bb.build.TaskProgress(taskprogress), self._data) |
| 152 | 166 | ||
