diff options
author | Richard Purdie <richard.purdie@linuxfoundation.org> | 2013-05-23 10:50:30 +0100 |
---|---|---|
committer | Richard Purdie <richard.purdie@linuxfoundation.org> | 2013-05-24 10:34:53 +0100 |
commit | 507d5cc2ccab6e1bff4731cfee663f615dc7ed57 (patch) | |
tree | c79f941d5b67db9d866928b3cfdcd125607937e9 /bitbake/lib/bb | |
parent | ea346917910734b6a9e537f83bd26b18cd3bf4f0 (diff) | |
download | ast2050-yocto-poky-507d5cc2ccab6e1bff4731cfee663f615dc7ed57.zip ast2050-yocto-poky-507d5cc2ccab6e1bff4731cfee663f615dc7ed57.tar.gz |
bitbake: cooker/cookerdata/event: Improve class handlers management
Similarly to the execution context changes, establish better lifetime
management API of the class event handlers.
(Bitbake rev: 54e35a6cceead9521f8b1dacd48e55064e85c8bd)
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
Diffstat (limited to 'bitbake/lib/bb')
-rw-r--r-- | bitbake/lib/bb/cooker.py | 4 | ||||
-rw-r--r-- | bitbake/lib/bb/cookerdata.py | 1 | ||||
-rw-r--r-- | bitbake/lib/bb/event.py | 11 |
3 files changed, 13 insertions, 3 deletions
diff --git a/bitbake/lib/bb/cooker.py b/bitbake/lib/bb/cooker.py index e868647..4c0b569 100644 --- a/bitbake/lib/bb/cooker.py +++ b/bitbake/lib/bb/cooker.py @@ -1455,7 +1455,7 @@ class Parser(multiprocessing.Process): self.init = init multiprocessing.Process.__init__(self) self.context = bb.utils.get_context().copy() - self.handlers = bb.event._handlers.copy() + self.handlers = bb.event.get_class_handlers().copy() def run(self): if self.init: @@ -1492,7 +1492,7 @@ class Parser(multiprocessing.Process): try: # Reset our environment and handlers to the original settings bb.utils.set_context(self.context.copy()) - bb.event._handlers = self.handlers.copy() + bb.event.set_class_handlers(self.handlers.copy()) return True, bb.cache.Cache.parse(filename, appends, self.cfg, caches_array) except Exception as exc: tb = sys.exc_info()[2] diff --git a/bitbake/lib/bb/cookerdata.py b/bitbake/lib/bb/cookerdata.py index de43310..2247f8d 100644 --- a/bitbake/lib/bb/cookerdata.py +++ b/bitbake/lib/bb/cookerdata.py @@ -174,6 +174,7 @@ class CookerDataBuilder(object): self.tracking = params.tracking bb.utils.set_context(bb.utils.clean_context()) + bb.event.set_class_handlers(bb.event.clean_class_handlers()) self.data = bb.data.init() if self.tracking: self.data.enableTracking() diff --git a/bitbake/lib/bb/event.py b/bitbake/lib/bb/event.py index 11c063f..2826e35 100644 --- a/bitbake/lib/bb/event.py +++ b/bitbake/lib/bb/event.py @@ -50,8 +50,17 @@ class Event(object): Registered = 10 AlreadyRegistered = 14 +def get_class_handlers(): + return _handlers + +def set_class_handlers(h): + _handlers = h + +def clean_class_handlers(): + return bb.compat.OrderedDict() + # Internal -_handlers = bb.compat.OrderedDict() +_handlers = clean_class_handlers() _ui_handlers = {} _ui_handler_seq = 0 |