diff options
author | Paul Eggleton <paul.eggleton@linux.intel.com> | 2015-08-05 15:48:00 +0100 |
---|---|---|
committer | Richard Purdie <richard.purdie@linuxfoundation.org> | 2016-09-03 23:45:46 +0100 |
commit | 5ec6d9ef309b841cdcbf1d14ac678d106d5d888a (patch) | |
tree | 0276975aedc0820dff4e28fcf7ddfea67fb6f5e3 /scripts/recipetool | |
parent | 55115f90f909d27599c686852e73df321ad1edff (diff) | |
download | openembedded-core-contrib-5ec6d9ef309b841cdcbf1d14ac678d106d5d888a.tar.gz |
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 ...").
Signed-off-by: Paul Eggleton <paul.eggleton@linux.intel.com>
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
Diffstat (limited to 'scripts/recipetool')
-rwxr-xr-x | scripts/recipetool | 63 |
1 files changed, 33 insertions, 30 deletions
diff --git a/scripts/recipetool b/scripts/recipetool index 17233d4ef0a..1052cd2b22c 100755 --- a/scripts/recipetool +++ b/scripts/recipetool @@ -77,37 +77,40 @@ def main(): scriptutils.logger_setup_color(logger, global_args.color) tinfoil = tinfoil_init(False) - for path in ([scripts_path] + - tinfoil.config_data.getVar('BBPATH', True).split(':')): - pluginpath = os.path.join(path, 'lib', 'recipetool') - scriptutils.load_plugins(logger, plugins, pluginpath) - - registered = False - for plugin in plugins: - if hasattr(plugin, 'register_commands'): - registered = True - plugin.register_commands(subparsers) - elif hasattr(plugin, 'register_command'): - # Legacy function name - registered = True - plugin.register_command(subparsers) - if hasattr(plugin, 'tinfoil_init'): - plugin.tinfoil_init(tinfoil) - - if not registered: - logger.error("No commands registered - missing plugins?") - sys.exit(1) - - args = parser.parse_args(unparsed_args, namespace=global_args) - try: - if getattr(args, 'parserecipes', False): - tinfoil.config_data.disableTracking() - tinfoil.parseRecipes() - tinfoil.config_data.enableTracking() - ret = args.func(args) - except bb.BBHandledException: - ret = 1 + for path in ([scripts_path] + + tinfoil.config_data.getVar('BBPATH', True).split(':')): + pluginpath = os.path.join(path, 'lib', 'recipetool') + scriptutils.load_plugins(logger, plugins, pluginpath) + + registered = False + for plugin in plugins: + if hasattr(plugin, 'register_commands'): + registered = True + plugin.register_commands(subparsers) + elif hasattr(plugin, 'register_command'): + # Legacy function name + registered = True + plugin.register_command(subparsers) + if hasattr(plugin, 'tinfoil_init'): + plugin.tinfoil_init(tinfoil) + + if not registered: + logger.error("No commands registered - missing plugins?") + sys.exit(1) + + args = parser.parse_args(unparsed_args, namespace=global_args) + + try: + if getattr(args, 'parserecipes', False): + tinfoil.config_data.disableTracking() + tinfoil.parseRecipes() + tinfoil.config_data.enableTracking() + ret = args.func(args) + except bb.BBHandledException: + ret = 1 + finally: + tinfoil.shutdown() return ret |