From 64c1a09023298e75eed0b2a0e736d1422f7f46b7 Mon Sep 17 00:00:00 2001 From: mathieui Date: Sat, 10 Aug 2013 00:24:27 +0200 Subject: Fix #2337 (search the themes the same way than plugins) - Load the themes from: 1 - The sources found in the directory ../data/themes/ (if it exists) 2 - The user-defined dir (or ~/.local/blah) 3 - The poezio_themes package if found - Also fix some potential issues with the plugins importer --- src/plugin_manager.py | 10 ++++------ 1 file changed, 4 insertions(+), 6 deletions(-) (limited to 'src/plugin_manager.py') diff --git a/src/plugin_manager.py b/src/plugin_manager.py index 4f728938..bb139dad 100644 --- a/src/plugin_manager.py +++ b/src/plugin_manager.py @@ -62,8 +62,6 @@ else: if poezio_plugins.__path__: load_path.append(poezio_plugins.__path__[0]) -sys.path.extend(load_path) - if version_info[1] >= 3: # 3.3 & > from importlib import machinery finder = machinery.PathFinder() @@ -111,7 +109,7 @@ class PluginManager(object): imp.acquire_lock() module = imp.load_module(name, file, filename, info) else: # 3.3 & > - loader = finder.find_module(name) + loader = finder.find_module(name, load_path) if not loader: self.core.information('Could not find plugin') return @@ -324,9 +322,9 @@ class PluginManager(object): def on_plugins_dir_change(self, new_value): global plugins_dir - if plugins_dir in sys.path: - sys.path.remove(plugins_dir) - sys.path.append(new_value) + if plugins_dir in load_path: + load_path.remove(plugins_dir) + load_path.insert(0, new_value) plugins_dir = new_value def on_plugins_conf_dir_change(self, new_value): -- cgit v1.2.3