From bc8971d122a02ed823acf0758da267dccc584f98 Mon Sep 17 00:00:00 2001 From: Richard Purdie Date: Thu, 12 May 2016 08:30:35 +0100 Subject: bitbake: bitbake: Convert to python 3 megacommit This needs breaking up into smaller changes. (Bitbake rev: cf51f19aed208a75d38c14cd585d9b9f115e3ba3) Signed-off-by: Richard Purdie --- bitbake/lib/bb/main.py | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) (limited to 'bitbake/lib/bb/main.py') diff --git a/bitbake/lib/bb/main.py b/bitbake/lib/bb/main.py index 761ea459cf..b296ef8b8c 100755 --- a/bitbake/lib/bb/main.py +++ b/bitbake/lib/bb/main.py @@ -27,6 +27,7 @@ import sys import logging import optparse import warnings +import fcntl import bb from bb import event @@ -336,10 +337,7 @@ def start_server(servermodule, configParams, configuration, features): server.saveConnectionDetails() except Exception as e: while hasattr(server, "event_queue"): - try: - import queue - except ImportError: - import Queue as queue + import queue try: event = server.event_queue.get(block=False) except (queue.Empty, IOError): @@ -363,7 +361,10 @@ def bitbake_main(configParams, configuration): # updates to log files for use with tail try: if sys.stdout.name == '': - sys.stdout = os.fdopen(sys.stdout.fileno(), 'w', 0) + # Reopen with O_SYNC (unbuffered) + fl = fcntl.fcntl(sys.stdout.fileno(), fcntl.F_GETFL) + fl |= os.O_SYNC + fcntl.fcntl(sys.stdout.fileno(), fcntl.F_SETFL, fl) except: pass -- cgit v1.2.3-54-g00ecf