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 d17f485c02..5594bb72d3 100644 --- a/meta/classes/base.bbclass +++ b/meta/classes/base.bbclass | |||
@@ -8,6 +8,32 @@ inherit utils | |||
8 | inherit utility-tasks | 8 | inherit utility-tasks |
9 | inherit metadata_scm | 9 | inherit metadata_scm |
10 | 10 | ||
11 | python sys_path_eh () { | ||
12 | if isinstance(e, bb.event.ConfigParsed): | ||
13 | import sys | ||
14 | import os | ||
15 | import time | ||
16 | |||
17 | bbpath = e.data.getVar("BBPATH", True).split(":") | ||
18 | sys.path[0:0] = [os.path.join(dir, "lib") for dir in bbpath] | ||
19 | |||
20 | def inject(name, value): | ||
21 | """Make a python object accessible from everywhere for the metadata""" | ||
22 | if hasattr(bb.utils, "_context"): | ||
23 | bb.utils._context[name] = value | ||
24 | else: | ||
25 | __builtins__[name] = value | ||
26 | |||
27 | import oe.path | ||
28 | import oe.utils | ||
29 | inject("bb", bb) | ||
30 | inject("sys", sys) | ||
31 | inject("time", time) | ||
32 | inject("oe", oe) | ||
33 | } | ||
34 | |||
35 | addhandler sys_path_eh | ||
36 | |||
11 | die() { | 37 | die() { |
12 | oefatal "$*" | 38 | oefatal "$*" |
13 | } | 39 | } |