summaryrefslogtreecommitdiffstats
path: root/bitbake/lib/bb/event.py
diff options
context:
space:
mode:
Diffstat (limited to 'bitbake/lib/bb/event.py')
-rw-r--r--bitbake/lib/bb/event.py29
1 files changed, 20 insertions, 9 deletions
diff --git a/bitbake/lib/bb/event.py b/bitbake/lib/bb/event.py
index 4761c86880..b29f0a5568 100644
--- a/bitbake/lib/bb/event.py
+++ b/bitbake/lib/bb/event.py
@@ -19,7 +19,6 @@ import sys
19import threading 19import threading
20import traceback 20import traceback
21 21
22import bb.exceptions
23import bb.utils 22import bb.utils
24 23
25# This is the pid for which we should generate the event. This is set when 24# This is the pid for which we should generate the event. This is set when
@@ -195,7 +194,12 @@ def fire_ui_handlers(event, d):
195 ui_queue.append(event) 194 ui_queue.append(event)
196 return 195 return
197 196
198 with bb.utils.lock_timeout(_thread_lock): 197 with bb.utils.lock_timeout_nocheck(_thread_lock) as lock:
198 if not lock:
199 # If we can't get the lock, we may be recursively called, queue and return
200 ui_queue.append(event)
201 return
202
199 errors = [] 203 errors = []
200 for h in _ui_handlers: 204 for h in _ui_handlers:
201 #print "Sending event %s" % event 205 #print "Sending event %s" % event
@@ -214,6 +218,9 @@ def fire_ui_handlers(event, d):
214 for h in errors: 218 for h in errors:
215 del _ui_handlers[h] 219 del _ui_handlers[h]
216 220
221 while ui_queue:
222 fire_ui_handlers(ui_queue.pop(), d)
223
217def fire(event, d): 224def fire(event, d):
218 """Fire off an Event""" 225 """Fire off an Event"""
219 226
@@ -424,6 +431,16 @@ class RecipeEvent(Event):
424 self.fn = fn 431 self.fn = fn
425 Event.__init__(self) 432 Event.__init__(self)
426 433
434class RecipePreDeferredInherits(RecipeEvent):
435 """
436 Called before deferred inherits are processed so code can snoop on class extensions for example
437 Limitations: It won't see inherits of inherited classes and the data is unexpanded
438 """
439 def __init__(self, fn, inherits):
440 self.fn = fn
441 self.inherits = inherits
442 Event.__init__(self)
443
427class RecipePreFinalise(RecipeEvent): 444class RecipePreFinalise(RecipeEvent):
428 """ Recipe Parsing Complete but not yet finalised""" 445 """ Recipe Parsing Complete but not yet finalised"""
429 446
@@ -759,13 +776,7 @@ class LogHandler(logging.Handler):
759 776
760 def emit(self, record): 777 def emit(self, record):
761 if record.exc_info: 778 if record.exc_info:
762 etype, value, tb = record.exc_info 779 record.bb_exc_formatted = traceback.format_exception(*record.exc_info)
763 if hasattr(tb, 'tb_next'):
764 tb = list(bb.exceptions.extract_traceback(tb, context=3))
765 # Need to turn the value into something the logging system can pickle
766 record.bb_exc_info = (etype, value, tb)
767 record.bb_exc_formatted = bb.exceptions.format_exception(etype, value, tb, limit=5)
768 value = str(value)
769 record.exc_info = None 780 record.exc_info = None
770 fire(record, None) 781 fire(record, None)
771 782