diff options
-rwxr-xr-x | scripts/recipetool | 31 |
1 files changed, 18 insertions, 13 deletions
diff --git a/scripts/recipetool b/scripts/recipetool index 3063cf7c43..37c2dd31f4 100755 --- a/scripts/recipetool +++ b/scripts/recipetool @@ -36,11 +36,8 @@ def tinfoil_init(parserecipes): import logging tinfoil = bb.tinfoil.Tinfoil() tinfoil.prepare(not parserecipes) - - for plugin in plugins: - if hasattr(plugin, 'tinfoil_init'): - plugin.tinfoil_init(tinfoil) tinfoil.logger.setLevel(logger.getEffectiveLevel()) + return tinfoil def main(): @@ -55,12 +52,26 @@ def main(): parser.add_argument('--color', choices=['auto', 'always', 'never'], default='auto', help='Colorize output (where %(metavar)s is %(choices)s)', metavar='COLOR') subparsers = parser.add_subparsers(title='subcommands', metavar='<subcommand>') - scriptutils.load_plugins(logger, plugins, os.path.join(scripts_path, 'lib', 'recipetool')) + import scriptpath + bitbakepath = scriptpath.add_bitbake_lib_path() + if not bitbakepath: + logger.error("Unable to find bitbake by searching parent directory of this script or PATH") + sys.exit(1) + logger.debug('Found bitbake path: %s' % bitbakepath) + + 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_command'): 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?") @@ -73,17 +84,11 @@ def main(): elif args.quiet: logger.setLevel(logging.ERROR) - import scriptpath - bitbakepath = scriptpath.add_bitbake_lib_path() - if not bitbakepath: - logger.error("Unable to find bitbake by searching parent directory of this script or PATH") - sys.exit(1) - logger.debug('Found bitbake path: %s' % bitbakepath) - scriptutils.logger_setup_color(logger, args.color) try: - tinfoil_init(getattr(args, 'parserecipes', False)) + if getattr(args, 'parserecipes', False): + tinfoil.parseRecipes() ret = args.func(args) except bb.BBHandledException: ret = 1 |