From 3c195dd9ccef1adbb59ad8db7fcc7086fd01b667 Mon Sep 17 00:00:00 2001 From: mathieui Date: Sat, 20 Dec 2014 23:32:56 +0100 Subject: Remove the remaining pre-3.4 compatibility hacks --- src/plugin_manager.py | 30 +++++++----------------------- 1 file changed, 7 insertions(+), 23 deletions(-) (limited to 'src/plugin_manager.py') 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 -- cgit v1.2.3