mirror of
https://git.yoctoproject.org/poky
synced 2026-06-01 00:59:48 +00:00
base: Switch to use addpylib directive and BB_GLOBAL_PYMODULES
Since bitbake now supports an official method to inject python modules, switch to it. Anyone using OE_EXTRA_IMPORTS will need to adjust their code accordingly, probably switching to their own module namespace. Also switch to using BB_GLOBAL_PYMODULES to list the global modules to import. (From OE-Core rev: 1f56155e91da2030ee0a5e93037c62e1349ba89f) Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
This commit is contained in:
@@ -15,31 +15,8 @@ inherit utils
|
||||
inherit utility-tasks
|
||||
inherit logging
|
||||
|
||||
OE_EXTRA_IMPORTS ?= ""
|
||||
|
||||
OE_IMPORTS += "os sys time oe.path oe.utils oe.types oe.package oe.packagegroup oe.sstatesig oe.lsb oe.cachedpath oe.license oe.qa oe.reproducible oe.rust oe.buildcfg ${OE_EXTRA_IMPORTS}"
|
||||
OE_IMPORTS[type] = "list"
|
||||
|
||||
PACKAGECONFIG_CONFARGS ??= ""
|
||||
|
||||
def oe_import(d):
|
||||
import sys
|
||||
|
||||
bbpath = [os.path.join(dir, "lib") for dir in d.getVar("BBPATH").split(":")]
|
||||
sys.path[0:0] = [dir for dir in bbpath if dir not in sys.path]
|
||||
|
||||
import oe.data
|
||||
for toimport in oe.data.typed_value("OE_IMPORTS", d):
|
||||
try:
|
||||
# Make a python object accessible from the metadata
|
||||
bb.utils._context[toimport.split(".", 1)[0]] = __import__(toimport)
|
||||
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)}"
|
||||
|
||||
inherit metadata_scm
|
||||
|
||||
def lsb_distro_identifier(d):
|
||||
|
||||
Reference in New Issue
Block a user