]> git.ipfire.org Git - thirdparty/openembedded/openembedded-core-contrib.git/commitdiff
base: Don't add duplicates to sys.path
authorRichard Purdie <richard.purdie@linuxfoundation.org>
Thu, 31 Mar 2022 11:01:50 +0000 (12:01 +0100)
committerRichard Purdie <richard.purdie@linuxfoundation.org>
Fri, 1 Apr 2022 22:05:31 +0000 (23:05 +0100)
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>
meta/classes/base.bbclass

index cc81461473f2226413698ee699e3f70a9152ee73..e51722d945d0715651a4857b2f336ac224980635 100644 (file)
@@ -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"""