Module: deluge
Branch: 1.3-stable
Commit: 4c32aa14d0a9d303a21efe5db58c37186727514c

Author: Calum Lind <[email protected]>
Date:   Wed Jun  8 22:46:23 2011 +0100

modify pluginbasemanager to search for egg_info dirs

---

 deluge/pluginmanagerbase.py |   18 +++++++++++++-----
 1 files changed, 13 insertions(+), 5 deletions(-)

diff --git a/deluge/pluginmanagerbase.py b/deluge/pluginmanagerbase.py
index 4256a46..da46449 100644
--- a/deluge/pluginmanagerbase.py
+++ b/deluge/pluginmanagerbase.py
@@ -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):

-- 
You received this message because you are subscribed to the Google Groups 
"deluge-commit" group.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to 
[email protected].
For more options, visit this group at 
http://groups.google.com/group/deluge-commit?hl=en.

Reply via email to