base.bbclass: Run oe_import before other INHERITs
RFC PATCH 1/3 base.bbclass: Run oe_import before other INHERITs
Its possible for classes listed in INHERIT directives to use things like the oe.utils functions. If that happens the user sees a traceback since the modules don't become available until the ConfigParsed event.
Whilst rather ugly, this change means that the oe modules become available much sooner and can be used in the core classes, including within base.bbclass.
---
meta/classes/base.bbclass +7 -1
@@ -31,8 +31,14 @@ def oe_import(d): imported = __import__(toimport) inject(toimport.split(".", 1)[0], imported) + return "" + +# We need the oe module name space early (before INHERITs get added) +# and whilst ugly, abusing inherit like this is quite effective +BASEIMPORTS = "${@oe_import(d)}" +inherit ${BASEIMPORTS} + python oe_import_eh () { - oe_import(e.data) e.data.setVar("NATIVELSBSTRING", lsb_distro_identifier(e.data)) }
meta/classes/base.bbclass def oe_import(d): · line 39
Quoted 5 lines · Richard Purdie
meta/classes/base.bbclass +4
-0+# We need the oe module name space early (before INHERITs get added) +# and whilst ugly, abusing inherit like this is quite effective +BASEIMPORTS = "${@oe_import(d)}" +inherit ${BASEIMPORTS}
Wouldn't OE_IMPORTED := "${@oe_import(d)}" work as well, or am I missing something?
Signature · 5 lines
Christopher Larson clarson at kergoth dot com Founder - BitBake, OpenEmbedded, OpenZaurus Maintainer - Tslib Senior Software Engineer, Mentor Graphics
Quoted 10 lines · Chris Larson
On Wed, Mar 26, 2014 at 2:30 AM, Richard Purdie <[email protected]> wrote:
+# We need the oe module name space early (before INHERITs get added)
+# and whilst ugly, abusing inherit like this is quite effective
+BASEIMPORTS = "${@oe_import(d)}"
+inherit ${BASEIMPORTS}
Quoted 2 lines
Wouldn't
OE_IMPORTED:= "${@oe_import(d)}" work as well, or am I missing something?
That would work as well. I just came to the other solution though a different route... :)
Cheers,
Richard