Re: [OE-core] [PATCH 1/2] base: Don't add duplicates to sys.path

2022-03-31 Thread Ross Burton
Oh, this might explain some weird errors I was having.  See the
de-duplication patch last week or so for oeqa.

Ross

On Thu, 31 Mar 2022 at 12:01, Richard Purdie
 wrote:
>
> 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 
> ---
>  meta/classes/base.bbclass | 4 ++--
>  1 file changed, 2 insertions(+), 2 deletions(-)
>
> diff --git a/meta/classes/base.bbclass b/meta/classes/base.bbclass
> index cc81461473f..e51722d945d 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"""
> --
> 2.32.0
>
>
> 
>

-=-=-=-=-=-=-=-=-=-=-=-
Links: You receive all messages sent to this group.
View/Reply Online (#163838): 
https://lists.openembedded.org/g/openembedded-core/message/163838
Mute This Topic: https://lists.openembedded.org/mt/90152116/21656
Group Owner: openembedded-core+ow...@lists.openembedded.org
Unsubscribe: https://lists.openembedded.org/g/openembedded-core/unsub 
[arch...@mail-archive.com]
-=-=-=-=-=-=-=-=-=-=-=-



[OE-core] [PATCH 1/2] base: Don't add duplicates to sys.path

2022-03-31 Thread Richard Purdie
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 
---
 meta/classes/base.bbclass | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/meta/classes/base.bbclass b/meta/classes/base.bbclass
index cc81461473f..e51722d945d 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"""
-- 
2.32.0


-=-=-=-=-=-=-=-=-=-=-=-
Links: You receive all messages sent to this group.
View/Reply Online (#163808): 
https://lists.openembedded.org/g/openembedded-core/message/163808
Mute This Topic: https://lists.openembedded.org/mt/90152116/21656
Group Owner: openembedded-core+ow...@lists.openembedded.org
Unsubscribe: https://lists.openembedded.org/g/openembedded-core/unsub 
[arch...@mail-archive.com]
-=-=-=-=-=-=-=-=-=-=-=-