diff options
Diffstat (limited to 'meta/classes/base.bbclass')
-rw-r--r-- | meta/classes/base.bbclass | 22 |
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 | |||
10 | inherit buildstats | 10 | inherit buildstats |
11 | inherit logging | 11 | inherit logging |
12 | 12 | ||
13 | python sys_path_eh () { | 13 | OE_IMPORTS += "os sys time oe.path oe.utils oe.data" |
14 | |||
15 | python oe_import () { | ||
14 | if isinstance(e, bb.event.ConfigParsed): | 16 | if isinstance(e, bb.event.ConfigParsed): |
15 | import sys | 17 | import os, sys |
16 | import os | ||
17 | import time | ||
18 | 18 | ||
19 | bbpath = e.data.getVar("BBPATH", True).split(":") | 19 | bbpath = e.data.getVar("BBPATH", True).split(":") |
20 | sys.path[0:0] = [os.path.join(dir, "lib") for dir in bbpath] | 20 | sys.path[0:0] = [os.path.join(dir, "lib") for dir in bbpath] |
21 | 21 | ||
22 | def inject(name, value): | 22 | def inject(name, value): |
23 | """Make a python object accessible from everywhere for the metadata""" | 23 | """Make a python object accessible from the metadata""" |
24 | if hasattr(bb.utils, "_context"): | 24 | if hasattr(bb.utils, "_context"): |
25 | bb.utils._context[name] = value | 25 | bb.utils._context[name] = value |
26 | else: | 26 | else: |
27 | __builtins__[name] = value | 27 | __builtins__[name] = value |
28 | 28 | ||
29 | import oe.path | 29 | for toimport in e.data.getVar("OE_IMPORTS", True).split(): |
30 | import oe.utils | 30 | imported = __import__(toimport) |
31 | import oe.data | 31 | inject(toimport.split(".", 1)[0], imported) |
32 | inject("bb", bb) | ||
33 | inject("sys", sys) | ||
34 | inject("time", time) | ||
35 | inject("oe", oe) | ||
36 | } | 32 | } |
37 | 33 | ||
38 | addhandler sys_path_eh | 34 | addhandler oe_import |
39 | 35 | ||
40 | die() { | 36 | die() { |
41 | bbfatal "$*" | 37 | bbfatal "$*" |