| Submitter | Bernhard Reutner-Fischer |
|---|---|
| Date | 2010-02-08 21:14:33 |
| Message ID | <1265663673-16312-13-git-send-email-rep.dot.nop@gmail.com> |
| Download | mbox | patch |
| Permalink | /patch/1555/ |
| State | Applied, archived |
| Headers | show |
Comments
On Mon, 2010-02-08 at 22:14 +0100, Bernhard Reutner-Fischer wrote: > - if not hasattr(__builtins__, 'set'): > + try: > + set > + except NameError: > from sets import Set as set It's not completely obvious to me that this patch is an improvement: it replaces a single line of code with three new ones and doesn't seem to change the outcome. Maybe one of our Python überhackers can comment on whether or not this is really better. p.
On Thu, Feb 11, 2010 at 5:04 AM, Phil Blundell <philb@gnu.org> wrote: > On Mon, 2010-02-08 at 22:14 +0100, Bernhard Reutner-Fischer wrote: >> - if not hasattr(__builtins__, 'set'): >> + try: >> + set >> + except NameError: >> from sets import Set as set > > It's not completely obvious to me that this patch is an improvement: it > replaces a single line of code with three new ones and doesn't seem to > change the outcome. Maybe one of our Python überhackers can comment on > whether or not this is really better. hasatts uses getattr and catches the exception from getattr. There was a problem in hasattr where it returned False on any exception generated from getaddr so the result could be unreliable. But this may not be applicable in this particular case I still see NOTE: Handling BitBake files: \ (7015/8051) [87 %]__builtin__:10: DeprecationWarning: the sets module is deprecated NOTE: Handling BitBake files: | (8051/8051) [100 %] Parsing of 8051 .bb files complete (0 cached, 8051 parsed). 7800 targets, 333 skipped, 157 masked, 0 errors. > > p. > > > > _______________________________________________ > Openembedded-devel mailing list > Openembedded-devel@lists.openembedded.org > http://lists.linuxtogo.org/cgi-bin/mailman/listinfo/openembedded-devel >
Patch
diff --git a/recipes/tasks/task-base.bb b/recipes/tasks/task-base.bb index d59acba..fc04b46 100644 --- a/recipes/tasks/task-base.bb +++ b/recipes/tasks/task-base.bb @@ -136,7 +136,9 @@ python __anonymous () { import bb - if not hasattr(__builtins__, 'set'): + try: + set + except NameError: from sets import Set as set distro_features = set(bb.data.getVar("DISTRO_FEATURES", d, 1).split())
Signed-off-by: Bernhard Reutner-Fischer <rep.dot.nop@gmail.com> --- recipes/tasks/task-base.bb | 4 +++- 1 files changed, 3 insertions(+), 1 deletions(-)