diff options
author | Dave Cobbley <david.j.cobbley@linux.intel.com> | 2018-08-14 20:05:37 +0300 |
---|---|---|
committer | Brad Bishop <bradleyb@fuzziesquirrel.com> | 2018-08-23 04:26:31 +0300 |
commit | eb8dc40360f0cfef56fb6947cc817a547d6d9bc6 (patch) | |
tree | de291a73dc37168da6370e2cf16c347d1eba9df8 /poky/meta-selftest/lib/devtool/bbpath.py | |
parent | 9c3cf826d853102535ead04cebc2d6023eff3032 (diff) | |
download | openbmc-eb8dc40360f0cfef56fb6947cc817a547d6d9bc6.tar.xz |
[Subtree] Removing import-layers directory
As part of the move to subtrees, need to bring all the import layers
content to the top level.
Change-Id: I4a163d10898cbc6e11c27f776f60e1a470049d8f
Signed-off-by: Dave Cobbley <david.j.cobbley@linux.intel.com>
Signed-off-by: Brad Bishop <bradleyb@fuzziesquirrel.com>
Diffstat (limited to 'poky/meta-selftest/lib/devtool/bbpath.py')
-rw-r--r-- | poky/meta-selftest/lib/devtool/bbpath.py | 44 |
1 files changed, 44 insertions, 0 deletions
diff --git a/poky/meta-selftest/lib/devtool/bbpath.py b/poky/meta-selftest/lib/devtool/bbpath.py new file mode 100644 index 000000000..5e8ffb3af --- /dev/null +++ b/poky/meta-selftest/lib/devtool/bbpath.py @@ -0,0 +1,44 @@ +import argparse + +already_loaded = False +kept_context = None + +def plugin_name(filename): + return os.path.splitext(os.path.basename(filename))[0] + +def plugin_init(plugins): + global already_loaded + already_loaded = plugin_name(__file__) in (plugin_name(p.__name__) for p in plugins) + +def print_name(args, config, basepath, workspace): + print (__file__) + +def print_bbdir(args, config, basepath, workspace): + print (__file__.replace('/lib/devtool/bbpath.py','')) + +def print_registered(args, config, basepath, workspace): + global kept_context + print(kept_context.loaded) + +def multiloaded(args, config, basepath, workspace): + global already_loaded + print("yes" if already_loaded else "no") + +def register_commands(subparsers, context): + global kept_context + kept_context = context + if 'loaded' in context.__dict__: + context.loaded += 1 + else: + context.loaded = 1 + + def addparser(name, helptxt, func): + parser = subparsers.add_parser(name, help=helptxt, + formatter_class=argparse.ArgumentDefaultsHelpFormatter) + parser.set_defaults(func=func) + return parser + + addparser('pluginfile', 'Print the filename of this plugin', print_name) + addparser('bbdir', 'Print the BBPATH directory of this plugin', print_bbdir) + addparser('count', 'How many times have this plugin been registered.', print_registered) + addparser('multiloaded', 'How many times have this plugin been initialized', multiloaded) |