diff options
Diffstat (limited to 'scripts/recipetool')
-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): | |||
36 | import logging | 36 | import logging |
37 | tinfoil = bb.tinfoil.Tinfoil() | 37 | tinfoil = bb.tinfoil.Tinfoil() |
38 | tinfoil.prepare(not parserecipes) | 38 | tinfoil.prepare(not parserecipes) |
39 | |||
40 | for plugin in plugins: | ||
41 | if hasattr(plugin, 'tinfoil_init'): | ||
42 | plugin.tinfoil_init(tinfoil) | ||
43 | tinfoil.logger.setLevel(logger.getEffectiveLevel()) | 39 | tinfoil.logger.setLevel(logger.getEffectiveLevel()) |
40 | return tinfoil | ||
44 | 41 | ||
45 | def main(): | 42 | def main(): |
46 | 43 | ||
@@ -55,12 +52,26 @@ def main(): | |||
55 | parser.add_argument('--color', choices=['auto', 'always', 'never'], default='auto', help='Colorize output (where %(metavar)s is %(choices)s)', metavar='COLOR') | 52 | parser.add_argument('--color', choices=['auto', 'always', 'never'], default='auto', help='Colorize output (where %(metavar)s is %(choices)s)', metavar='COLOR') |
56 | subparsers = parser.add_subparsers(title='subcommands', metavar='<subcommand>') | 53 | subparsers = parser.add_subparsers(title='subcommands', metavar='<subcommand>') |
57 | 54 | ||
58 | scriptutils.load_plugins(logger, plugins, os.path.join(scripts_path, 'lib', 'recipetool')) | 55 | import scriptpath |
56 | bitbakepath = scriptpath.add_bitbake_lib_path() | ||
57 | if not bitbakepath: | ||
58 | logger.error("Unable to find bitbake by searching parent directory of this script or PATH") | ||
59 | sys.exit(1) | ||
60 | logger.debug('Found bitbake path: %s' % bitbakepath) | ||
61 | |||
62 | tinfoil = tinfoil_init(False) | ||
63 | for path in ([scripts_path] + | ||
64 | tinfoil.config_data.getVar('BBPATH', True).split(':')): | ||
65 | pluginpath = os.path.join(path, 'lib', 'recipetool') | ||
66 | scriptutils.load_plugins(logger, plugins, pluginpath) | ||
67 | |||
59 | registered = False | 68 | registered = False |
60 | for plugin in plugins: | 69 | for plugin in plugins: |
61 | if hasattr(plugin, 'register_command'): | 70 | if hasattr(plugin, 'register_command'): |
62 | registered = True | 71 | registered = True |
63 | plugin.register_command(subparsers) | 72 | plugin.register_command(subparsers) |
73 | if hasattr(plugin, 'tinfoil_init'): | ||
74 | plugin.tinfoil_init(tinfoil) | ||
64 | 75 | ||
65 | if not registered: | 76 | if not registered: |
66 | logger.error("No commands registered - missing plugins?") | 77 | logger.error("No commands registered - missing plugins?") |
@@ -73,17 +84,11 @@ def main(): | |||
73 | elif args.quiet: | 84 | elif args.quiet: |
74 | logger.setLevel(logging.ERROR) | 85 | logger.setLevel(logging.ERROR) |
75 | 86 | ||
76 | import scriptpath | ||
77 | bitbakepath = scriptpath.add_bitbake_lib_path() | ||
78 | if not bitbakepath: | ||
79 | logger.error("Unable to find bitbake by searching parent directory of this script or PATH") | ||
80 | sys.exit(1) | ||
81 | logger.debug('Found bitbake path: %s' % bitbakepath) | ||
82 | |||
83 | scriptutils.logger_setup_color(logger, args.color) | 87 | scriptutils.logger_setup_color(logger, args.color) |
84 | 88 | ||
85 | try: | 89 | try: |
86 | tinfoil_init(getattr(args, 'parserecipes', False)) | 90 | if getattr(args, 'parserecipes', False): |
91 | tinfoil.parseRecipes() | ||
87 | ret = args.func(args) | 92 | ret = args.func(args) |
88 | except bb.BBHandledException: | 93 | except bb.BBHandledException: |
89 | ret = 1 | 94 | ret = 1 |