|
@@ -21,6 +21,34 @@
|
|
|
THISDIR = "${@os.path.dirname(d.getVar('FILE', True))}"
|
|
|
FILESPATH = "${@base_set_filespath(["${FILE_DIRNAME}/${PF}", "${FILE_DIRNAME}/${P}", "${FILE_DIRNAME}/${PN}", "${FILE_DIRNAME}/files", "${FILE_DIRNAME}"], d)}"
|
|
|
|
|
|
+OE_IMPORTS += "os sys time oe.path oe.patch"
|
|
|
+OE_IMPORTS[type] = "list"
|
|
|
+
|
|
|
+def oe_import(d):
|
|
|
+ import sys
|
|
|
+
|
|
|
+ bbpath = d.getVar("BBPATH").split(":")
|
|
|
+ sys.path[0:0] = [os.path.join(dir, "lib") for dir in bbpath]
|
|
|
+
|
|
|
+ def inject(name, value):
|
|
|
+ """Make a python object accessible from the metadata"""
|
|
|
+ if hasattr(bb.utils, "_context"):
|
|
|
+ bb.utils._context[name] = value
|
|
|
+ else:
|
|
|
+ __builtins__[name] = value
|
|
|
+
|
|
|
+ import oe.data
|
|
|
+ for toimport in oe.data.typed_value("OE_IMPORTS", d):
|
|
|
+ try:
|
|
|
+ imported = __import__(toimport)
|
|
|
+ inject(toimport.split(".", 1)[0], imported)
|
|
|
+ except AttributeError as e:
|
|
|
+ bb.error("Error importing OE modules: %s" % str(e))
|
|
|
+ return ""
|
|
|
+
|
|
|
+# We need the oe module name space early (before INHERITs get added)
|
|
|
+OE_IMPORTED := "${@oe_import(d)}"
|
|
|
+
|
|
|
def get_deb_host_arch():
|
|
|
import subprocess
|
|
|
host_arch = subprocess.check_output(
|