[oe] [PATCH] packaged-staging.bbclass: use 'os.unlink()' instead of spawning 'rm'

Tom Rini tom_rini at mentor.com
Wed Mar 17 18:18:10 UTC 2010


On Wed, 2010-03-17 at 10:48 -0700, Tom Rini wrote:
> On Wed, 2010-03-17 at 18:39 +0100, Michael 'Mickey' Lauer wrote:
> > > > +def _package_unlink (f):
> > > > +    import os
> > > > +    try:
> > > > +	os.unlink(f)
> > > > +	return True
> > > > +    except:
> > > > +	return False
> > > > +
> > 
> > While it won't hurt in this particular case, a catch-all 'except'
> > usually is frowned upon. Better catch specific errors and let other
> > errors be handled by the upper layers. I'd recommend catching IOError
> > only here.
> 
> We need to catch OSError too as this continues to leave behind
> directories.

Or, not.  But while we're in here, we should change from bb.note to
bb.debug (and, keep it where it is).  That's probably the best way to
despam output but have something useful if needed.

-- 
Tom Rini <tom_rini at mentor.com>
Mentor Graphics Corporation




More information about the Openembedded-devel mailing list