scripts: ensure tinfoil is shut down correctly

We should always shut down tinfoil when we're finished with it, either
by explicitly calling the shutdown() method or by using it as a
context manager ("with ...").

(From OE-Core rev: 5ec6d9ef309b841cdcbf1d14ac678d106d5d888a)

Signed-off-by: Paul Eggleton <paul.eggleton@linux.intel.com>
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
This commit is contained in:
Paul Eggleton
2015-08-05 15:48:00 +01:00
committed by Richard Purdie
parent f2854c67ce
commit e616beba1c
10 changed files with 414 additions and 385 deletions

View File

@@ -289,17 +289,15 @@ def main():
if global_args.bbpath is None:
tinfoil = setup_tinfoil(config_only=True, basepath=basepath)
global_args.bbpath = tinfoil.config_data.getVar('BBPATH', True)
else:
tinfoil = None
try:
global_args.bbpath = tinfoil.config_data.getVar('BBPATH', True)
finally:
tinfoil.shutdown()
for path in [scripts_path] + global_args.bbpath.split(':'):
pluginpath = os.path.join(path, 'lib', 'devtool')
scriptutils.load_plugins(logger, plugins, pluginpath)
if tinfoil:
tinfoil.shutdown()
subparsers = parser.add_subparsers(dest="subparser_name", title='subcommands', metavar='<subcommand>')
subparsers.required = True