diff options
author | mathieui <mathieui@mathieui.net> | 2014-12-20 23:32:56 +0100 |
---|---|---|
committer | mathieui <mathieui@mathieui.net> | 2014-12-20 23:32:56 +0100 |
commit | 3c195dd9ccef1adbb59ad8db7fcc7086fd01b667 (patch) | |
tree | f80f790330f87b98dcae066d45228f0f49306db4 /src/plugin_manager.py | |
parent | 2452706b909364178655c6c918a0348fb4298fb2 (diff) | |
download | poezio-3c195dd9ccef1adbb59ad8db7fcc7086fd01b667.tar.gz poezio-3c195dd9ccef1adbb59ad8db7fcc7086fd01b667.tar.bz2 poezio-3c195dd9ccef1adbb59ad8db7fcc7086fd01b667.tar.xz poezio-3c195dd9ccef1adbb59ad8db7fcc7086fd01b667.zip |
Remove the remaining pre-3.4 compatibility hacks
Diffstat (limited to 'src/plugin_manager.py')
-rw-r--r-- | src/plugin_manager.py | 30 |
1 files changed, 7 insertions, 23 deletions
diff --git a/src/plugin_manager.py b/src/plugin_manager.py index d4cc7384..7e3659e4 100644 --- a/src/plugin_manager.py +++ b/src/plugin_manager.py @@ -5,12 +5,10 @@ the API together. Defines also a bunch of variables related to the plugin env. """ -import imp import os from os import path import logging from gettext import gettext as _ -from sys import version_info import core import tabs @@ -44,9 +42,8 @@ class PluginManager(object): self.tab_keys = {} self.roster_elements = {} - if version_info[1] >= 3: # 3.3 & > - from importlib import machinery - self.finder = machinery.PathFinder() + from importlib import machinery + self.finder = machinery.PathFinder() self.initial_set_plugins_dir() self.initial_set_plugins_conf_dir() @@ -70,29 +67,16 @@ class PluginManager(object): try: module = None - if version_info[1] < 3: # < 3.3 - if name in self.modules: - imp.acquire_lock() - module = imp.reload(self.modules[name]) - else: - file, filename, info = imp.find_module(name, - self.load_path) - imp.acquire_lock() - module = imp.load_module(name, file, filename, info) - else: # 3.3 & > - loader = self.finder.find_module(name, self.load_path) - if not loader: - self.core.information('Could not find plugin: %s' % name) - return - module = loader.load_module() - + loader = self.finder.find_module(name, self.load_path) + if not loader: + self.core.information('Could not find plugin: %s' % name) + return + module = loader.load_module() except Exception as e: log.debug("Could not load plugin %s", name, exc_info=True) self.core.information("Could not load plugin %s: %s" % (name, e), 'Error') finally: - if version_info[1] < 3 and imp.lock_held(): - imp.release_lock() if not module: return |