No Description
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

core_scripts.py 1.2KB

1234567891011121314151617181920212223242526272829303132
  1. import lodel.plugin.scripts as lodel_script
  2. ##@brief Implements lodel_admin.py discover-plugin action
  3. #
  4. #In depth directory scan to find plugins.
  5. class DiscoverPlugin(lodel_script.LodelScript):
  6. _action = 'discover-plugin'
  7. _description = 'Walk through given folders looking for plugins'
  8. @classmethod
  9. def argparser_config(cls, parser):
  10. parser.add_argument('-d', '--directory',
  11. help="Directory to walk through looking for lodel2 plugins",
  12. nargs='+')
  13. parser.add_argument('-l', '--list-only', default=False,
  14. action = 'store_true',
  15. help="Use this option to print a list of discovered plugins \
  16. without modifying existing cache")
  17. @classmethod
  18. def run(cls, args):
  19. from lodel.plugin.plugins import Plugin
  20. if args.directory is None or len(args.directory) == 0:
  21. cls.help_exit("Specify a least one directory")
  22. no_cache = args.list_only
  23. res = Plugin.discover(args.directory, no_cache)
  24. print("Found plugins in : %s" % ', '.join(args.directory))
  25. for pname, pinfos in res['plugins'].items():
  26. print("\t- %s(%s) in %s" % (
  27. pname, pinfos['version'], pinfos['path']))