aboutsummaryrefslogtreecommitdiffstats
path: root/classes/base.bbclass
diff options
context:
space:
mode:
authorChris Larson <chris_larson@mentor.com>2010-04-14 17:57:00 -0700
committerChris Larson <chris_larson@mentor.com>2010-04-23 14:20:41 -0700
commit5816ec4860aba7289483b87b4aa4909eee50fae9 (patch)
treed9b0cbde34688feacaec41a20c1df000a92d84c2 /classes/base.bbclass
parent5c8bfd6873939024d57278343035cfab0257bdb3 (diff)
downloadopenembedded-5816ec4860aba7289483b87b4aa4909eee50fae9.tar.gz
base.bbclass: add <dir>/lib for each dir in BBPATH to the python search path
Also makes the os, time, and bb package availability explicit. Signed-off-by: Chris Larson <chris_larson@mentor.com>
Diffstat (limited to 'classes/base.bbclass')
-rw-r--r--classes/base.bbclass23
1 files changed, 23 insertions, 0 deletions
diff --git a/classes/base.bbclass b/classes/base.bbclass
index c43f2b2b35..3e94f3aa86 100644
--- a/classes/base.bbclass
+++ b/classes/base.bbclass
@@ -9,6 +9,29 @@ inherit utils
inherit utility-tasks
inherit metadata_scm
+python sys_path_eh () {
+ if isinstance(e, bb.event.ConfigParsed):
+ import sys
+ import os
+ import time
+
+ 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"""
+ if hasattr(bb.utils, "_context"):
+ bb.utils._context[name] = value
+ else:
+ __builtins__[name] = value
+
+ inject("bb", bb)
+ inject("sys", sys)
+ inject("time", time)
+}
+
+addhandler sys_path_eh
+
die() {
oefatal "$*"
}