On Wednesday 23 September 2015 08:09:37 Christopher Larson wrote: > On Wed, Sep 23, 2015 at 3:05 AM, Paul Eggleton < > > paul.eggle...@linux.intel.com> wrote: > > -def setup_tinfoil(config_only=False): > > > > +def setup_tinfoil(config_only=False, basepath=None): > > """Initialize tinfoil api from bitbake""" > > import scriptpath > > > > + orig_cwd = os.path.abspath(os.curdir) > > + if basepath: > > + os.chdir(basepath) > > > > bitbakepath = scriptpath.add_bitbake_lib_path() > > > > if not bitbakepath: > > logger.error("Unable to find bitbake by searching parent > > > > directory of this script or PATH") > > > > @@ -108,6 +111,7 @@ def setup_tinfoil(config_only=False): > > tinfoil = bb.tinfoil.Tinfoil() > > tinfoil.prepare(config_only) > > tinfoil.logger.setLevel(logger.getEffectiveLevel()) > > > > + os.chdir(orig_cwd) > > > > return tinfoil > > Just from a correctness standpoint, this will not go back to orig_cwd if an > exception is raised. We should be using a try/finally block for things like > this.
That is a good point yes. I can send out a v3. Cheers, Paul -- Paul Eggleton Intel Open Source Technology Centre -- _______________________________________________ Openembedded-core mailing list Openembedded-core@lists.openembedded.org http://lists.openembedded.org/mailman/listinfo/openembedded-core