display the imaplib and python versions for each normal run

Some users might use more than one python/imaplib version. This tends to make
debugging and support harder.

Displaying this information by default for each run should help.

Signed-off-by: Nicolas Sebrecht <nicolas.s-dev@laposte.net>
This commit is contained in:
Nicolas Sebrecht 2017-04-30 13:25:40 +02:00
parent 8c04684f3b
commit 22a163a768

View File

@ -1,5 +1,5 @@
# OfflineIMAP initialization code
# Copyright (C) 2002-2016 John Goerzen & contributors
# Copyright (C) 2002-2017 John Goerzen & contributors
#
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
@ -72,6 +72,11 @@ class OfflineImap(object):
oi.run()
"""
def get_env_info(self):
return "imaplib2 v%s (%s), Python v%s"% (
imaplib.__version__, imaplib.DESC, PYTHON_VERSION
)
def run(self):
"""Parse the commandline and invoke everything"""
# next line also sets self.config and self.ui
@ -180,9 +185,8 @@ class OfflineImap(object):
glob.set_options(options)
if options.version:
print("offlineimap v%s, imaplib2 v%s (%s), Python v%s"% (
offlineimap.__version__, imaplib.__version__, imaplib.DESC,
PYTHON_VERSION)
print("offlineimap v%s, %s"% (
offlineimap.__version__, self.get_env_info())
)
sys.exit(0)
@ -273,6 +277,7 @@ class OfflineImap(object):
# Welcome blurb.
self.ui.init_banner()
self.ui.info(self.get_env_info())
if options.debugtype:
self.ui.logger.setLevel(logging.DEBUG)