summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorRichard Purdie <richard.purdie@linuxfoundation.org>2022-03-31 12:01:50 +0100
committerRichard Purdie <richard.purdie@linuxfoundation.org>2022-04-01 23:05:31 +0100
commitdadce8468db1c0fd0e04801cdc6cf287c2808477 (patch)
treeaa502c482effab6a1b095beb3a4e26919f8488c1
parent42e68397ec74b3cd8ae5df45355c8f6254b48cd8 (diff)
downloadopenembedded-core-contrib-dadce8468db1c0fd0e04801cdc6cf287c2808477.tar.gz
base: Don't add duplicates to sys.path
We can re-trigger this code and there is little point in stacking a ton of duplicate paths which just waste time during searches for modules. This could in theory alter layer module search order but that seems unlikely in common use. Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org> Signed-off-by: Alexandre Belloni <alexandre.belloni@bootlin.com>
-rw-r--r--meta/classes/base.bbclass4
1 files changed, 2 insertions, 2 deletions
diff --git a/meta/classes/base.bbclass b/meta/classes/base.bbclass
index cc81461473..e51722d945 100644
--- a/meta/classes/base.bbclass
+++ b/meta/classes/base.bbclass
@@ -20,8 +20,8 @@ PACKAGECONFIG_CONFARGS ??= ""
def oe_import(d):
import sys
- bbpath = d.getVar("BBPATH").split(":")
- sys.path[0:0] = [os.path.join(dir, "lib") for dir in bbpath]
+ 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]
def inject(name, value):
"""Make a python object accessible from the metadata"""