All of lore.kernel.org
 help / color / mirror / Atom feed
From: Richard Purdie <richard.purdie@linuxfoundation.org>
To: Paul Eggleton <paul.eggleton@linux.intel.com>
Cc: bitbake-devel@lists.openembedded.org
Subject: Re: [PATCH] bitbake:main.py: Handle RuntimeError exception in list_extension_modules
Date: Fri, 21 Aug 2015 17:53:05 +0100	[thread overview]
Message-ID: <1440175985.12105.263.camel@linuxfoundation.org> (raw)
In-Reply-To: <240026922.piU8TeAAyb@peggleto-mobl.ger.corp.intel.com>

On Fri, 2015-08-21 at 09:07 +0100, Paul Eggleton wrote:
> On Friday 21 August 2015 00:51:44 Olof Johansson wrote:
> > On 15-08-20 23:00 +0200, Randy Witt wrote:
> > > --- a/bitbake/lib/bb/main.py
> > > +++ b/bitbake/lib/bb/main.py
> > > 
> > > @@ -60,7 +60,7 @@ def list_extension_modules(pkg, checkattr):
> > >              continue
> > >          
> > >          try:
> > >              module = __import__(pkg.__name__, fromlist=[modulename])
> > > 
> > > -        except (ImportError, SystemExit):
> > > 
> > > +        except (ImportError, SystemExit, RuntimeError):
> > >              # If we can't import it, it's not valid
> > >              continue
> > >          
> > >          module_if = getattr(module, modulename)
> > 
> > Wouldn't it be better to just skip naming the exceptions you want
> > to catch in this case? I.e.:
> > 
> >    try:
> >      module = __import__(...
> >    except:
> >      continue
> > 
> > "If we can't import it" ...
> 
> As a matter of good practice I try to avoid eating all exceptions that way in 
> case one of them is a genuine error rather than something we want to ignore. 
> Maybe this is a reasonable exception (heh) though.

I think in this case, a generic except might be a better alternative. I
agree in general its a bad idea. I merged the other fix since it got us
around the issue whilst we could consider what to do about it.

> FWIW we might consider just reverting my change if it's causing too much 
> greif.

I think I'd be happier if it only tried to import the UIs if --help were
specified. How you do that with python argument handling I'm less sure
of though...

Cheers,

Richard



      reply	other threads:[~2015-08-21 16:53 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-08-20 21:00 [PATCH] bitbake:main.py: Handle RuntimeError exception in list_extension_modules Randy Witt
2015-08-20 22:51 ` Olof Johansson
2015-08-21  8:07   ` Paul Eggleton
2015-08-21 16:53     ` Richard Purdie [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=1440175985.12105.263.camel@linuxfoundation.org \
    --to=richard.purdie@linuxfoundation.org \
    --cc=bitbake-devel@lists.openembedded.org \
    --cc=paul.eggleton@linux.intel.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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.