summaryrefslogtreecommitdiffstats
path: root/bitbake/lib
diff options
context:
space:
mode:
Diffstat (limited to 'bitbake/lib')
-rw-r--r--bitbake/lib/bb/event.py10
-rw-r--r--bitbake/lib/bb/server/process.py2
-rw-r--r--bitbake/lib/bb/server/xmlrpc.py2
3 files changed, 9 insertions, 5 deletions
diff --git a/bitbake/lib/bb/event.py b/bitbake/lib/bb/event.py
index 3f96bcab32..366bc41884 100644
--- a/bitbake/lib/bb/event.py
+++ b/bitbake/lib/bb/event.py
@@ -69,6 +69,7 @@ _ui_handler_seq = 0
69_event_handler_map = {} 69_event_handler_map = {}
70_catchall_handlers = {} 70_catchall_handlers = {}
71_eventfilter = None 71_eventfilter = None
72_uiready = False
72 73
73def execute_handler(name, handler, event, d): 74def execute_handler(name, handler, event, d):
74 event.data = d 75 event.data = d
@@ -113,7 +114,7 @@ def print_ui_queue():
113 """If we're exiting before a UI has been spawned, display any queued 114 """If we're exiting before a UI has been spawned, display any queued
114 LogRecords to the console.""" 115 LogRecords to the console."""
115 logger = logging.getLogger("BitBake") 116 logger = logging.getLogger("BitBake")
116 if not _ui_handlers: 117 if not _uiready:
117 from bb.msg import BBLogFormatter 118 from bb.msg import BBLogFormatter
118 console = logging.StreamHandler(sys.stdout) 119 console = logging.StreamHandler(sys.stdout)
119 console.setFormatter(BBLogFormatter("%(levelname)s: %(message)s")) 120 console.setFormatter(BBLogFormatter("%(levelname)s: %(message)s"))
@@ -135,7 +136,7 @@ def print_ui_queue():
135 logger.handle(event) 136 logger.handle(event)
136 137
137def fire_ui_handlers(event, d): 138def fire_ui_handlers(event, d):
138 if not _ui_handlers: 139 if not _uiready:
139 # No UI handlers registered yet, queue up the messages 140 # No UI handlers registered yet, queue up the messages
140 ui_queue.append(event) 141 ui_queue.append(event)
141 return 142 return
@@ -219,7 +220,10 @@ def set_eventfilter(func):
219 global _eventfilter 220 global _eventfilter
220 _eventfilter = func 221 _eventfilter = func
221 222
222def register_UIHhandler(handler): 223def register_UIHhandler(handler, mainui=False):
224 if mainui:
225 global _uiready
226 _uiready = True
223 bb.event._ui_handler_seq = bb.event._ui_handler_seq + 1 227 bb.event._ui_handler_seq = bb.event._ui_handler_seq + 1
224 _ui_handlers[_ui_handler_seq] = handler 228 _ui_handlers[_ui_handler_seq] = handler
225 level, debug_domains = bb.msg.constructLogOptions() 229 level, debug_domains = bb.msg.constructLogOptions()
diff --git a/bitbake/lib/bb/server/process.py b/bitbake/lib/bb/server/process.py
index 3198635e2f..f022b86c94 100644
--- a/bitbake/lib/bb/server/process.py
+++ b/bitbake/lib/bb/server/process.py
@@ -97,7 +97,7 @@ class ProcessServer(Process, BaseImplServer):
97 def run(self): 97 def run(self):
98 for event in bb.event.ui_queue: 98 for event in bb.event.ui_queue:
99 self.event_queue.put(event) 99 self.event_queue.put(event)
100 self.event_handle.value = bb.event.register_UIHhandler(self) 100 self.event_handle.value = bb.event.register_UIHhandler(self, True)
101 101
102 bb.cooker.server_main(self.cooker, self.main) 102 bb.cooker.server_main(self.cooker, self.main)
103 103
diff --git a/bitbake/lib/bb/server/xmlrpc.py b/bitbake/lib/bb/server/xmlrpc.py
index f1a2067246..b7647c198f 100644
--- a/bitbake/lib/bb/server/xmlrpc.py
+++ b/bitbake/lib/bb/server/xmlrpc.py
@@ -99,7 +99,7 @@ class BitBakeServerCommands():
99 if (self.cooker.state in [bb.cooker.state.parsing, bb.cooker.state.running]): 99 if (self.cooker.state in [bb.cooker.state.parsing, bb.cooker.state.running]):
100 return None 100 return None
101 101
102 self.event_handle = bb.event.register_UIHhandler(s) 102 self.event_handle = bb.event.register_UIHhandler(s, True)
103 return self.event_handle 103 return self.event_handle
104 104
105 def unregisterEventHandler(self, handlerNum): 105 def unregisterEventHandler(self, handlerNum):