PluginManager/PluginManager.py

branch
Py2 comp.
changeset 3523
8df1ab89e261
parent 3520
bfcefbb1633c
child 3621
15f23ed3f216
equal deleted inserted replaced
3520:bfcefbb1633c 3523:8df1ab89e261
5 5
6 """ 6 """
7 Module implementing the Plugin Manager. 7 Module implementing the Plugin Manager.
8 """ 8 """
9 9
10 from __future__ import unicode_literals 10 from __future__ import unicode_literals, print_function
11 11
12 import os 12 import os
13 import sys 13 import sys
14 import imp 14 import imp
15 import zipfile 15 import zipfile
346 if not hasattr(module, "python2Compatible"): 346 if not hasattr(module, "python2Compatible"):
347 module.error = self.tr( 347 module.error = self.tr(
348 "Module is missing the Python2 compatibility flag." 348 "Module is missing the Python2 compatibility flag."
349 " Please update.") 349 " Please update.")
350 compatible = False 350 compatible = False
351 elif getattr(module, "python2Compatible"): 351 elif not getattr(module, "python2Compatible"):
352 module.error = self.tr( 352 module.error = self.tr(
353 "Module is not Python2 compatible.") 353 "Module is not Python2 compatible.")
354 compatible = False 354 compatible = False
355 else: 355 else:
356 compatible = True 356 compatible = True
376 imp.reload(module) 376 imp.reload(module)
377 except PluginLoadError: 377 except PluginLoadError:
378 print("Error loading plug-in module:", name) 378 print("Error loading plug-in module:", name)
379 except PluginPy2IncompatibleError: 379 except PluginPy2IncompatibleError:
380 print("Error loading plug-in module:", name) 380 print("Error loading plug-in module:", name)
381 print("Th plug-in is not Python2 compatible.") 381 print("The plug-in is not Python2 compatible.")
382 except Exception as err: 382 except Exception as err:
383 module = imp.new_module(name) 383 module = imp.new_module(name)
384 module.error = self.tr( 384 module.error = self.tr(
385 "Module failed to load. Error: {0}").format(str(err)) 385 "Module failed to load. Error: {0}").format(str(err))
386 self.__failedModules[name] = module 386 self.__failedModules[name] = module

eric ide

mercurial