From: Patrick Ohly <patrick.ohly@intel.com>
To: Richard Purdie <richard.purdie@linuxfoundation.org>
Cc: bitbake-devel <bitbake-devel@lists.openembedded.org>
Subject: Re: [PATCH] data_smart/utils: Add 'd' to the context used for better_eval in python expansion
Date: Mon, 13 Jun 2016 10:32:58 +0200 [thread overview]
Message-ID: <1465806778.28019.1.camel@intel.com> (raw)
In-Reply-To: <1465511881.13979.156.camel@linuxfoundation.org>
On Thu, 2016-06-09 at 23:38 +0100, Richard Purdie wrote:
> If a line like:
>
> foo=${@' '.join([d.getVar('D', True) + x for x in (' '.join([d.getVar('FILES_bash-' + p, True) or '' for p in ['lib', 'dev', 'staticdev', 'doc', 'locale', 'ptest']])).split()])}
>
> is added to a function like do_install, it fails with Exception name 'd'
> is not defined. This is due to a change of behaviour in python 3 compared
> to python 2. Generator expressions, dict comprehensions and set comprehensions
> are executed in a new scope but list comprehensions in python 2.x are not. In
> python 3 they all use a new scope.
>
> To allow these kinds of expressions to work, the easiest approach is
> to add 'd' to the global context. To do this, an extra optional parameter
> is added to better_eval and we use that to add 'd'.
>
> Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
I'm building Ostro OS with this patch, which is where the scoping
problem was first found. Seems to work for me, so please include it.
--
Best Regards, Patrick Ohly
The content of this message is my personal opinion only and although
I am an employee of Intel, the statements I make here in no way
represent Intel's position on the issue, nor am I authorized to speak
on behalf of Intel on this matter.
prev parent reply other threads:[~2016-06-13 8:33 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2016-06-09 22:38 [PATCH] data_smart/utils: Add 'd' to the context used for better_eval in python expansion Richard Purdie
2016-06-13 8:32 ` Patrick Ohly [this message]
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=1465806778.28019.1.camel@intel.com \
--to=patrick.ohly@intel.com \
--cc=bitbake-devel@lists.openembedded.org \
--cc=richard.purdie@linuxfoundation.org \
/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