mirror of
https://git.yoctoproject.org/poky
synced 2026-06-01 00:59:48 +00:00
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>
This commit is contained in:
@@ -1455,7 +1455,7 @@ class Parser(multiprocessing.Process):
|
|||||||
self.init = init
|
self.init = init
|
||||||
multiprocessing.Process.__init__(self)
|
multiprocessing.Process.__init__(self)
|
||||||
self.context = bb.utils.get_context().copy()
|
self.context = bb.utils.get_context().copy()
|
||||||
self.handlers = bb.event._handlers.copy()
|
self.handlers = bb.event.get_class_handlers().copy()
|
||||||
|
|
||||||
def run(self):
|
def run(self):
|
||||||
if self.init:
|
if self.init:
|
||||||
@@ -1492,7 +1492,7 @@ class Parser(multiprocessing.Process):
|
|||||||
try:
|
try:
|
||||||
# Reset our environment and handlers to the original settings
|
# Reset our environment and handlers to the original settings
|
||||||
bb.utils.set_context(self.context.copy())
|
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)
|
return True, bb.cache.Cache.parse(filename, appends, self.cfg, caches_array)
|
||||||
except Exception as exc:
|
except Exception as exc:
|
||||||
tb = sys.exc_info()[2]
|
tb = sys.exc_info()[2]
|
||||||
|
|||||||
@@ -174,6 +174,7 @@ class CookerDataBuilder(object):
|
|||||||
self.tracking = params.tracking
|
self.tracking = params.tracking
|
||||||
|
|
||||||
bb.utils.set_context(bb.utils.clean_context())
|
bb.utils.set_context(bb.utils.clean_context())
|
||||||
|
bb.event.set_class_handlers(bb.event.clean_class_handlers())
|
||||||
self.data = bb.data.init()
|
self.data = bb.data.init()
|
||||||
if self.tracking:
|
if self.tracking:
|
||||||
self.data.enableTracking()
|
self.data.enableTracking()
|
||||||
|
|||||||
+10
-1
@@ -50,8 +50,17 @@ class Event(object):
|
|||||||
Registered = 10
|
Registered = 10
|
||||||
AlreadyRegistered = 14
|
AlreadyRegistered = 14
|
||||||
|
|
||||||
|
def get_class_handlers():
|
||||||
|
return _handlers
|
||||||
|
|
||||||
|
def set_class_handlers(h):
|
||||||
|
_handlers = h
|
||||||
|
|
||||||
|
def clean_class_handlers():
|
||||||
|
return bb.compat.OrderedDict()
|
||||||
|
|
||||||
# Internal
|
# Internal
|
||||||
_handlers = bb.compat.OrderedDict()
|
_handlers = clean_class_handlers()
|
||||||
_ui_handlers = {}
|
_ui_handlers = {}
|
||||||
_ui_handler_seq = 0
|
_ui_handler_seq = 0
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user