diff options
| -rw-r--r-- | bitbake/lib/bb/event.py | 8 |
1 files changed, 8 insertions, 0 deletions
diff --git a/bitbake/lib/bb/event.py b/bitbake/lib/bb/event.py index 32df779786..9645476e59 100644 --- a/bitbake/lib/bb/event.py +++ b/bitbake/lib/bb/event.py | |||
| @@ -67,6 +67,7 @@ _ui_logfilters = {} | |||
| 67 | _ui_handler_seq = 0 | 67 | _ui_handler_seq = 0 |
| 68 | _event_handler_map = {} | 68 | _event_handler_map = {} |
| 69 | _catchall_handlers = {} | 69 | _catchall_handlers = {} |
| 70 | _eventfilter = None | ||
| 70 | 71 | ||
| 71 | def execute_handler(name, handler, event, d): | 72 | def execute_handler(name, handler, event, d): |
| 72 | event.data = d | 73 | event.data = d |
| @@ -94,6 +95,9 @@ def fire_class_handlers(event, d): | |||
| 94 | evt_hmap = _event_handler_map.get(eid, {}) | 95 | evt_hmap = _event_handler_map.get(eid, {}) |
| 95 | for name, handler in _handlers.iteritems(): | 96 | for name, handler in _handlers.iteritems(): |
| 96 | if name in _catchall_handlers or name in evt_hmap: | 97 | if name in _catchall_handlers or name in evt_hmap: |
| 98 | if _eventfilter: | ||
| 99 | if not _eventfilter(name, handler, event, d): | ||
| 100 | continue | ||
| 97 | execute_handler(name, handler, event, d) | 101 | execute_handler(name, handler, event, d) |
| 98 | 102 | ||
| 99 | ui_queue = [] | 103 | ui_queue = [] |
| @@ -204,6 +208,10 @@ def remove(name, handler): | |||
| 204 | """Remove an Event handler""" | 208 | """Remove an Event handler""" |
| 205 | _handlers.pop(name) | 209 | _handlers.pop(name) |
| 206 | 210 | ||
| 211 | def set_eventfilter(func): | ||
| 212 | global _eventfilter | ||
| 213 | _eventfilter = func | ||
| 214 | |||
| 207 | def register_UIHhandler(handler): | 215 | def register_UIHhandler(handler): |
| 208 | bb.event._ui_handler_seq = bb.event._ui_handler_seq + 1 | 216 | bb.event._ui_handler_seq = bb.event._ui_handler_seq + 1 |
| 209 | _ui_handlers[_ui_handler_seq] = handler | 217 | _ui_handlers[_ui_handler_seq] = handler |
