--info displays the imaplib2 version and whether it's the bundled or system one

Signed-off-by: Nicolas Sebrecht <nicolas.s-dev@laposte.net>
This commit is contained in:
Nicolas Sebrecht 2016-06-04 15:20:08 +02:00
parent 9902a116c0
commit fd0198027a
2 changed files with 6 additions and 0 deletions

View File

@ -452,6 +452,7 @@ class OfflineImap(object):
account.syncrunner() account.syncrunner()
def __serverdiagnostics(self, options): def __serverdiagnostics(self, options):
self.ui.info(" imaplib2: %s (%s)"% (imaplib.__version__, imaplib.DESC))
activeaccounts = self.config.get("general", "accounts") activeaccounts = self.config.get("general", "accounts")
if options.accounts: if options.accounts:
activeaccounts = options.accounts activeaccounts = options.accounts

View File

@ -22,6 +22,8 @@ this virtual_imaplib2 or we might go into troubles.
""" """
DESC = None
_SUPPORTED_RELEASE = 2 _SUPPORTED_RELEASE = 2
_SUPPORTED_REVISION = 53 _SUPPORTED_REVISION = 53
@ -35,10 +37,12 @@ try:
int(imaplib.__revision__) < _SUPPORTED_REVISION): int(imaplib.__revision__) < _SUPPORTED_REVISION):
raise ImportError("The provided imaplib2 version '%s' is not supported"% raise ImportError("The provided imaplib2 version '%s' is not supported"%
imaplib.__version__) imaplib.__version__)
DESC = "system"
except (ImportError, NameError) as e: except (ImportError, NameError) as e:
try: try:
from offlineimap.bundled_imaplib2 import * from offlineimap.bundled_imaplib2 import *
import offlineimap.bundled_imaplib2 as imaplib import offlineimap.bundled_imaplib2 as imaplib
DESC = "bundled"
except: except:
print("Error while trying to import system imaplib2: %s"% e) print("Error while trying to import system imaplib2: %s"% e)
raise raise
@ -48,3 +52,4 @@ except (ImportError, NameError) as e:
InternalDate = imaplib.InternalDate InternalDate = imaplib.InternalDate
Mon2num = imaplib.Mon2num Mon2num = imaplib.Mon2num
MonthNames = imaplib.MonthNames MonthNames = imaplib.MonthNames
__version__ = imaplib.__version__