diff options
Diffstat (limited to 'meta/classes/base.bbclass')
-rw-r--r-- | meta/classes/base.bbclass | 26 |
1 files changed, 26 insertions, 0 deletions
diff --git a/meta/classes/base.bbclass b/meta/classes/base.bbclass index d17f485c0..5594bb72d 100644 --- a/meta/classes/base.bbclass +++ b/meta/classes/base.bbclass @@ -8,6 +8,32 @@ 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 + + import oe.path + import oe.utils + inject("bb", bb) + inject("sys", sys) + inject("time", time) + inject("oe", oe) +} + +addhandler sys_path_eh + die() { oefatal "$*" } |