summaryrefslogtreecommitdiffstats
path: root/external/poky/bitbake/lib/bb/progress.py
diff options
context:
space:
mode:
Diffstat (limited to 'external/poky/bitbake/lib/bb/progress.py')
-rw-r--r--external/poky/bitbake/lib/bb/progress.py29
1 files changed, 16 insertions, 13 deletions
diff --git a/external/poky/bitbake/lib/bb/progress.py b/external/poky/bitbake/lib/bb/progress.py
index f54d1c76..9c755b7f 100644
--- a/external/poky/bitbake/lib/bb/progress.py
+++ b/external/poky/bitbake/lib/bb/progress.py
@@ -4,25 +4,15 @@ BitBake progress handling code
# Copyright (C) 2016 Intel Corporation
#
-# This program is free software; you can redistribute it and/or modify
-# it under the terms of the GNU General Public License version 2 as
-# published by the Free Software Foundation.
+# SPDX-License-Identifier: GPL-2.0-only
#
-# This program is distributed in the hope that it will be useful,
-# but WITHOUT ANY WARRANTY; without even the implied warranty of
-# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-# GNU General Public License for more details.
-#
-# You should have received a copy of the GNU General Public License along
-# with this program; if not, write to the Free Software Foundation, Inc.,
-# 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
-import sys
import re
import time
import inspect
import bb.event
import bb.build
+from bb.build import StdoutNoopContextManager
class ProgressHandler(object):
"""
@@ -37,7 +27,14 @@ class ProgressHandler(object):
if outfile:
self._outfile = outfile
else:
- self._outfile = sys.stdout
+ self._outfile = StdoutNoopContextManager()
+
+ def __enter__(self):
+ self._outfile.__enter__()
+ return self
+
+ def __exit__(self, *excinfo):
+ self._outfile.__exit__(*excinfo)
def _fire_progress(self, taskprogress, rate=None):
"""Internal function to fire the progress event"""
@@ -157,6 +154,12 @@ class MultiStageProgressReporter(object):
self._stage_total = None
self._callers = []
+ def __enter__(self):
+ return self
+
+ def __exit__(self, *excinfo):
+ pass
+
def _fire_progress(self, taskprogress):
bb.event.fire(bb.build.TaskProgress(taskprogress), self._data)