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 | |
parent | ea346917910734b6a9e537f83bd26b18cd3bf4f0 (diff) | |
download | 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')
-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 e8686475b9..4c0b569439 100644 --- a/bitbake/lib/bb/cooker.py +++ b/bitbake/lib/bb/cooker.py | |||
@@ -1455,7 +1455,7 @@ class Parser(multiprocessing.Process): | |||
1455 | self.init = init | 1455 | self.init = init |
1456 | multiprocessing.Process.__init__(self) | 1456 | multiprocessing.Process.__init__(self) |
1457 | self.context = bb.utils.get_context().copy() | 1457 | self.context = bb.utils.get_context().copy() |
1458 | self.handlers = bb.event._handlers.copy() | 1458 | self.handlers = bb.event.get_class_handlers().copy() |
1459 | 1459 | ||
1460 | def run(self): | 1460 | def run(self): |
1461 | if self.init: | 1461 | if self.init: |
@@ -1492,7 +1492,7 @@ class Parser(multiprocessing.Process): | |||
1492 | try: | 1492 | try: |
1493 | # Reset our environment and handlers to the original settings | 1493 | # Reset our environment and handlers to the original settings |
1494 | bb.utils.set_context(self.context.copy()) | 1494 | bb.utils.set_context(self.context.copy()) |
1495 | bb.event._handlers = self.handlers.copy() | 1495 | bb.event.set_class_handlers(self.handlers.copy()) |
1496 | return True, bb.cache.Cache.parse(filename, appends, self.cfg, caches_array) | 1496 | return True, bb.cache.Cache.parse(filename, appends, self.cfg, caches_array) |
1497 | except Exception as exc: | 1497 | except Exception as exc: |
1498 | tb = sys.exc_info()[2] | 1498 | tb = sys.exc_info()[2] |
diff --git a/bitbake/lib/bb/cookerdata.py b/bitbake/lib/bb/cookerdata.py index de4331050d..2247f8d3bd 100644 --- a/bitbake/lib/bb/cookerdata.py +++ b/bitbake/lib/bb/cookerdata.py | |||
@@ -174,6 +174,7 @@ class CookerDataBuilder(object): | |||
174 | self.tracking = params.tracking | 174 | self.tracking = params.tracking |
175 | 175 | ||
176 | bb.utils.set_context(bb.utils.clean_context()) | 176 | bb.utils.set_context(bb.utils.clean_context()) |
177 | bb.event.set_class_handlers(bb.event.clean_class_handlers()) | ||
177 | self.data = bb.data.init() | 178 | self.data = bb.data.init() |
178 | if self.tracking: | 179 | if self.tracking: |
179 | self.data.enableTracking() | 180 | self.data.enableTracking() |
diff --git a/bitbake/lib/bb/event.py b/bitbake/lib/bb/event.py index 11c063fcc8..2826e3554f 100644 --- a/bitbake/lib/bb/event.py +++ b/bitbake/lib/bb/event.py | |||
@@ -50,8 +50,17 @@ class Event(object): | |||
50 | Registered = 10 | 50 | Registered = 10 |
51 | AlreadyRegistered = 14 | 51 | AlreadyRegistered = 14 |
52 | 52 | ||
53 | def get_class_handlers(): | ||
54 | return _handlers | ||
55 | |||
56 | def set_class_handlers(h): | ||
57 | _handlers = h | ||
58 | |||
59 | def clean_class_handlers(): | ||
60 | return bb.compat.OrderedDict() | ||
61 | |||
53 | # Internal | 62 | # Internal |
54 | _handlers = bb.compat.OrderedDict() | 63 | _handlers = clean_class_handlers() |
55 | _ui_handlers = {} | 64 | _ui_handlers = {} |
56 | _ui_handler_seq = 0 | 65 | _ui_handler_seq = 0 |
57 | 66 | ||