[gnome-continuous-yocto/gnomeostree-3.28-rocko: 2878/8267] bitbake: event: prevent unclosed file warning in print_ui_queue
- From: Emmanuele Bassi <ebassi src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gnome-continuous-yocto/gnomeostree-3.28-rocko: 2878/8267] bitbake: event: prevent unclosed file warning in print_ui_queue
- Date: Sat, 16 Dec 2017 23:50:52 +0000 (UTC)
commit 1110dde73aa04772090ca7b2b21a953d49734fb0
Author: Joshua Lock <joshua g lock intel com>
Date: Tue Oct 4 11:03:55 2016 +0100
bitbake: event: prevent unclosed file warning in print_ui_queue
Use logger.addHandler(), rather than assigning an array of Handlers
to the loggers handlers property directly, to avoid a warning from
Python 3 about unclosed files:
$ bitbake
Nothing to do. Use 'bitbake world' to build everything, or run 'bitbake --help' for usage information.
WARNING: /home/joshuagl/Projects/poky/bitbake/lib/bb/event.py:143: ResourceWarning: unclosed file
<_io.TextIOWrapper name='/home/joshuagl/Projects/poky/build/tmp/log/cooker/qemux86/20161004094928.log'
mode='a' encoding='UTF-8'>
logger.handlers = [stdout]
(Bitbake rev: 1e23b1f1a80066223b98e18b163840051ac74944)
Signed-off-by: Joshua Lock <joshua g lock intel com>
Signed-off-by: Richard Purdie <richard purdie linuxfoundation org>
bitbake/lib/bb/event.py | 6 +++---
1 files changed, 3 insertions(+), 3 deletions(-)
---
diff --git a/bitbake/lib/bb/event.py b/bitbake/lib/bb/event.py
index 65b7ebb..c5a5f94 100644
--- a/bitbake/lib/bb/event.py
+++ b/bitbake/lib/bb/event.py
@@ -143,16 +143,16 @@ def print_ui_queue():
if isinstance(event, logging.LogRecord):
if event.levelno > logging.DEBUG:
if event.levelno >= logging.WARNING:
- logger.handlers = [stderr]
+ logger.addHandler(stderr)
else:
- logger.handlers = [stdout]
+ logger.addHandler(stdout)
logger.handle(event)
msgprint = True
if msgprint:
return
# Nope, so just print all of the messages we have (including debug messages)
- logger.handlers = [stdout]
+ logger.addHandler(stdout)
for event in ui_queue:
if isinstance(event, logging.LogRecord):
logger.handle(event)
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]