def scan_for_plugins(self):
"""Plugin scanner.
Scans for plugins in the known plugin directories. Adds them to the
available plugins dictionary, ready to be loaded.
Returns:
The available plugins dictionary.
"""
_logger.debug("Scanning for plugins.")
for category,info in CATEGORIES.items():
_logger.debug("Scanning category {0}".format(category))
for module in os.listdir(os.path.join(os.path.dirname(__file__),info["directory"])):
if module == "__init__.py" or module[-3:] != ".py":
continue
_logger.debug("\tFound plugin {0}".format(module[:-3]))
importlib.import_module("aniping.{0}.{1}".format(info["directory"], module[:-3]))
self._available_plugins[category].append(module[:-3])
_logger.debug("All available plugins found.")
return self._available_plugins
评论列表
文章目录