summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorChris Larson <chris_larson@mentor.com>2011-02-09 07:09:43 -0700
committerRichard Purdie <richard.purdie@linuxfoundation.org>2011-05-20 17:34:22 +0100
commit6bdfae902ea61d5794dc65c3b0db744f5b2661b4 (patch)
treee2b6af2b2cdf63dc295f806b7f82279cca6c193d
parent4da8c86ca2b376149d425480e11ea1704dbc3ede (diff)
downloadpoky-6bdfae902ea61d5794dc65c3b0db744f5b2661b4.tar.gz
poky-6bdfae902ea61d5794dc65c3b0db744f5b2661b4.tar.bz2
poky-6bdfae902ea61d5794dc65c3b0db744f5b2661b4.zip
base.bbclass: switch to current OE's imports handling
The current mechanism makes it easier for classes to add new oe modules to be automatically imported, and thereby made available to python snippets (${@}). (From OE-Core rev: 0c560a2a7954412f714db86b1aaadb7acbe72d1b) Signed-off-by: Chris Larson <chris_larson@mentor.com> Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
-rw-r--r--meta/classes/base.bbclass22
1 files changed, 9 insertions, 13 deletions
diff --git a/meta/classes/base.bbclass b/meta/classes/base.bbclass
index 5ccc553bc4..d40d5863c9 100644
--- a/meta/classes/base.bbclass
+++ b/meta/classes/base.bbclass
@@ -10,32 +10,28 @@ inherit metadata_scm
inherit buildstats
inherit logging
-python sys_path_eh () {
+OE_IMPORTS += "os sys time oe.path oe.utils oe.data"
+
+python oe_import () {
if isinstance(e, bb.event.ConfigParsed):
- import sys
- import os
- import time
+ import os, sys
bbpath = e.data.getVar("BBPATH", True).split(":")
sys.path[0:0] = [os.path.join(dir, "lib") for dir in bbpath]
def inject(name, value):
- """Make a python object accessible from everywhere for the metadata"""
+ """Make a python object accessible from the metadata"""
if hasattr(bb.utils, "_context"):
bb.utils._context[name] = value
else:
__builtins__[name] = value
- import oe.path
- import oe.utils
- import oe.data
- inject("bb", bb)
- inject("sys", sys)
- inject("time", time)
- inject("oe", oe)
+ for toimport in e.data.getVar("OE_IMPORTS", True).split():
+ imported = __import__(toimport)
+ inject(toimport.split(".", 1)[0], imported)
}
-addhandler sys_path_eh
+addhandler oe_import
die() {
bbfatal "$*"