mirror of
https://github.com/codex-storage/deluge.git
synced 2025-01-13 04:54:23 +00:00
modify pluginbasemanager to search for egg_info dirs
This commit is contained in:
parent
5d9120b667
commit
4c32aa14d0
@ -102,18 +102,26 @@ class PluginManagerBase:
|
||||
|
||||
def scan_for_plugins(self):
|
||||
"""Scans for available plugins"""
|
||||
plugin_dir = os.path.join(os.path.dirname(__file__), "plugins")
|
||||
base_plugin_dir = os.path.join(os.path.dirname(__file__), "plugins")
|
||||
pkg_resources.working_set.add_entry(base_plugin_dir)
|
||||
user_plugin_dir = os.path.join(deluge.configmanager.get_config_dir(), "plugins")
|
||||
|
||||
pkg_resources.working_set.add_entry(plugin_dir)
|
||||
plugins_dirs = [base_plugin_dir]
|
||||
for dirname in os.listdir(base_plugin_dir):
|
||||
plugin_dir = os.path.join(base_plugin_dir, dirname)
|
||||
pkg_resources.working_set.add_entry(plugin_dir)
|
||||
plugins_dirs.append(plugin_dir)
|
||||
pkg_resources.working_set.add_entry(user_plugin_dir)
|
||||
self.pkg_env = pkg_resources.Environment([plugin_dir, user_plugin_dir])
|
||||
plugins_dirs.append(user_plugin_dir)
|
||||
|
||||
self.pkg_env = pkg_resources.Environment(plugins_dirs)
|
||||
|
||||
self.available_plugins = []
|
||||
for name in self.pkg_env:
|
||||
log.debug("Found plugin: %s %s",
|
||||
log.debug("Found plugin: %s %s at %s",
|
||||
self.pkg_env[name][0].project_name,
|
||||
self.pkg_env[name][0].version)
|
||||
self.pkg_env[name][0].version,
|
||||
self.pkg_env[name][0].location)
|
||||
self.available_plugins.append(self.pkg_env[name][0].project_name)
|
||||
|
||||
def enable_plugin(self, plugin_name):
|
||||
|
Loading…
x
Reference in New Issue
Block a user