summaryrefslogtreecommitdiffstats
path: root/meta/classes/base.bbclass
diff options
context:
space:
mode:
authorRichard Purdie <richard.purdie@linuxfoundation.org>2022-03-31 12:01:51 +0100
committerRichard Purdie <richard.purdie@linuxfoundation.org>2022-04-01 23:11:37 +0100
commite00f9ea165a253a2be6d03cf32a747f766e116d3 (patch)
tree3c432954f16747f7e052ffd4f7be45daafca9b35 /meta/classes/base.bbclass
parent61c7c8f175d3ed1b14cb50ebeae6358dab69dbdf (diff)
downloadpoky-e00f9ea165a253a2be6d03cf32a747f766e116d3.tar.gz
base: Clean up module import compatibility code
This code was for old versions of bitbake which we're now long past. Drop it and simplify the code. (From OE-Core rev: d5301d008a5cc02a08d660691fce2c18ed8028d7) Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org> Signed-off-by: Alexandre Belloni <alexandre.belloni@bootlin.com> Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
Diffstat (limited to 'meta/classes/base.bbclass')
-rw-r--r--meta/classes/base.bbclass11
1 files changed, 2 insertions, 9 deletions
diff --git a/meta/classes/base.bbclass b/meta/classes/base.bbclass
index e51722d945..3515720bf9 100644
--- a/meta/classes/base.bbclass
+++ b/meta/classes/base.bbclass
@@ -23,18 +23,11 @@ def oe_import(d):
23 bbpath = [os.path.join(dir, "lib") for dir in d.getVar("BBPATH").split(":")] 23 bbpath = [os.path.join(dir, "lib") for dir in d.getVar("BBPATH").split(":")]
24 sys.path[0:0] = [dir for dir in bbpath if dir not in sys.path] 24 sys.path[0:0] = [dir for dir in bbpath if dir not in sys.path]
25 25
26 def inject(name, value):
27 """Make a python object accessible from the metadata"""
28 if hasattr(bb.utils, "_context"):
29 bb.utils._context[name] = value
30 else:
31 __builtins__[name] = value
32
33 import oe.data 26 import oe.data
34 for toimport in oe.data.typed_value("OE_IMPORTS", d): 27 for toimport in oe.data.typed_value("OE_IMPORTS", d):
35 try: 28 try:
36 imported = __import__(toimport) 29 # Make a python object accessible from the metadata
37 inject(toimport.split(".", 1)[0], imported) 30 bb.utils._context[toimport.split(".", 1)[0]] = __import__(toimport)
38 except AttributeError as e: 31 except AttributeError as e:
39 bb.error("Error importing OE modules: %s" % str(e)) 32 bb.error("Error importing OE modules: %s" % str(e))
40 return "" 33 return ""