summaryrefslogtreecommitdiff
path: root/classes/base.bbclass
diff options
context:
space:
mode:
authorChris Larson <chris_larson@mentor.com>2010-08-23 16:39:20 -0400
committerChris Larson <chris_larson@mentor.com>2010-08-23 20:40:12 -0400
commit744016016a6c3ca59da5068afec91a2834d73fd8 (patch)
tree5770932834d1e975d235fe358ac74aab6825faed /classes/base.bbclass
parent0a11eb71464b263412243dd3dd3e0cb2bbf6332f (diff)
base: use a variable for the modules to import/inject
Signed-off-by: Chris Larson <chris_larson@mentor.com>
Diffstat (limited to 'classes/base.bbclass')
-rw-r--r--classes/base.bbclass22
1 files changed, 9 insertions, 13 deletions
diff --git a/classes/base.bbclass b/classes/base.bbclass
index 89f983f548..afc30da9c2 100644
--- a/classes/base.bbclass
+++ b/classes/base.bbclass
@@ -9,31 +9,27 @@ inherit utils
inherit utility-tasks
inherit metadata_scm
-python sys_path_eh () {
- if isinstance(e, bb.event.ConfigParsed):
- import sys
- import os
- import time
+OE_IMPORTS += "oe.path oe.utils sys os time"
+python oe_import () {
+ if isinstance(e, bb.event.ConfigParsed):
+ 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
- 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() {
oefatal "$*"