public inbox for isar-users@googlegroups.com
 help / color / mirror / Atom feed
From: Jan Kiszka <jan.kiszka@siemens.com>
To: "[ext] claudius.heine.ext@siemens.com"
	<claudius.heine.ext@siemens.com>,
	isar-users@googlegroups.com,
	Henning Schild <henning.schild@siemens.com>
Cc: Claudius Heine <ch@denx.de>
Subject: Re: [PATCH 1/2] meta/classes/base: extend sys.path with lib directory
Date: Thu, 15 Feb 2018 08:28:18 +0100	[thread overview]
Message-ID: <c1fe5941-b680-0fc6-ef4c-cf4379dbbfe1@siemens.com> (raw)
In-Reply-To: <20180214131509.16361-2-claudius.heine.ext@siemens.com>

On 2018-02-14 14:15, [ext] claudius.heine.ext@siemens.com wrote:
> From: Claudius Heine <ch@denx.de>
> 
> Currently scripts and modules that are placed in the 'lib' directory of
> layers are not available in the recipes.
> 
> This change adds the required code to the base.bbclass in order to have
> those imports available.
> 
> This change contains code from:
> http://git.openembedded.org/openembedded-core/tree/meta/classes/base.bbclass?id=4a4eff9b9e3c614ff41b17cbec359b72dcbd41bd
> 
> Signed-off-by: Claudius Heine <ch@denx.de>
> ---
>  meta/classes/base.bbclass | 24 ++++++++++++++++++++++++
>  1 file changed, 24 insertions(+)
> 
> diff --git a/meta/classes/base.bbclass b/meta/classes/base.bbclass
> index ae84677..3334789 100644
> --- a/meta/classes/base.bbclass
> +++ b/meta/classes/base.bbclass
> @@ -37,6 +37,30 @@ bbfatal() {
>  	exit 1
>  }
>  
> +# Derived from openembedded-core/meta/classes/base.bbclass
> +ISAR_IMPORTS += "os sys time"
> +
> +def isar_imports(d):
> +	import sys
> +
> +	bbpath = d.getVar("BBPATH").split(":")
> +	sys.path[0:0] = [os.path.join(dir, "lib") for dir in bbpath]
> +
> +	def inject(name, value):
> +		"""Make a python object accessible from the metadata"""
> +		if hasattr(bb.utils, "_context"):
> +			bb.utils._context[name] = value
> +		else:
> +			__builtins__[name] = value
> +
> +	for toimport in d.getVar("ISAR_IMPORTS", True).split():
> +		imported = __import__(toimport)
> +		inject(toimport.split(".", 1)[0], imported)
> +
> +	return ""
> +
> +ISAR_IMPORTED := "${@isar_imports(d)}"
> +
>  # Derived from bitbake: bitbake/classes/base.bbclass
>  addtask showdata
>  do_showdata[nostamp] = "1"
> 

Henning, does this help with selecting wic plugins as well? Or does wic
express its search paths differently and would not be affected by this
change?

Jan

-- 
Siemens AG, Corporate Technology, CT RDA IOT SES-DE
Corporate Competence Center Embedded Linux

  reply	other threads:[~2018-02-15  7:28 UTC|newest]

Thread overview: 23+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-02-14 13:15 [PATCH 0/2] Consolidate multistrap configuration generation claudius.heine.ext
2018-02-14 13:15 ` [PATCH 1/2] meta/classes/base: extend sys.path with lib directory claudius.heine.ext
2018-02-15  7:28   ` Jan Kiszka [this message]
2018-02-14 13:15 ` [PATCH 2/2] centralize multistrap configuration generation claudius.heine.ext
2018-02-15  7:28   ` Jan Kiszka
2018-02-15  8:16     ` Claudius Heine
2018-02-15  8:50       ` Jan Kiszka
2018-02-15  9:34     ` Alexander Smirnov
2018-02-15 10:05       ` Claudius Heine
2018-02-15 10:15         ` Jan Kiszka
2018-02-15 10:29           ` Alexander Smirnov
2018-02-15 11:27           ` Baurzhan Ismagulov
2018-02-15 13:17             ` Claudius Heine
2018-02-15 13:18             ` Jan Kiszka
2018-02-15 11:42   ` Baurzhan Ismagulov
2018-02-15 12:08     ` Claudius Heine
2018-02-15 12:37       ` Alexander Smirnov
2018-02-15 13:20         ` Claudius Heine
2018-02-15 13:39           ` Alexander Smirnov
2018-02-16  9:31             ` Claudius Heine
2018-02-16 10:35               ` Alexander Smirnov
2018-02-16 11:35                 ` Jan Kiszka
2018-02-15 13:53           ` Jan Kiszka

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=c1fe5941-b680-0fc6-ef4c-cf4379dbbfe1@siemens.com \
    --to=jan.kiszka@siemens.com \
    --cc=ch@denx.de \
    --cc=claudius.heine.ext@siemens.com \
    --cc=henning.schild@siemens.com \
    --cc=isar-users@googlegroups.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox