diff --git a/offlineimap/__init__.py b/offlineimap/__init__.py index 819391f..3f48421 100644 --- a/offlineimap/__init__.py +++ b/offlineimap/__init__.py @@ -1,18 +1,17 @@ __all__ = ['OfflineImap'] -__productname__ = 'OfflineIMAP' -# Expecting trailing "-rcN" or "" for stable releases. -__version__ = "7.3.3" -__copyright__ = "Copyright 2002-2020 John Goerzen & contributors" -__author__ = "John Goerzen" -__author_email__= "offlineimap-project@lists.alioth.debian.org" -__description__ = "Disconnected Universal IMAP Mail Synchronization/Reader Support" -__license__ = "Licensed under the GNU GPL v2 or any later version (with an OpenSSL exception)" -__bigcopyright__ = """%(__productname__)s %(__version__)s - %(__license__)s""" % locals() -__homepage__ = "http://www.offlineimap.org" - -banner = __bigcopyright__ +from offlineimap.version import ( + __productname__, + __version__, + __copyright__, + __author__, + __author_email__, + __description__, + __license__, + __bigcopyright__, + __homepage__, + banner + ) from offlineimap.error import OfflineImapError # put this last, so we don't run into circular dependencies using diff --git a/offlineimap/version.py b/offlineimap/version.py new file mode 100644 index 0000000..c21cd4f --- /dev/null +++ b/offlineimap/version.py @@ -0,0 +1,13 @@ +__productname__ = 'OfflineIMAP' +# Expecting trailing "-rcN" or "" for stable releases. +__version__ = "7.3.3" +__copyright__ = "Copyright 2002-2020 John Goerzen & contributors" +__author__ = "John Goerzen" +__author_email__= "offlineimap-project@lists.alioth.debian.org" +__description__ = "Disconnected Universal IMAP Mail Synchronization/Reader Support" +__license__ = "Licensed under the GNU GPL v2 or any later version (with an OpenSSL exception)" +__bigcopyright__ = """%(__productname__)s %(__version__)s + %(__license__)s""" % locals() +__homepage__ = "http://www.offlineimap.org" + +banner = __bigcopyright__ diff --git a/setup.py b/setup.py index e4528db..9080410 100644 --- a/setup.py +++ b/setup.py @@ -23,9 +23,13 @@ import os from distutils.core import setup, Command -import offlineimap import logging -from test.OLItest import TextTestRunner, TestLoader, OLITestLib + +from os import path +here = path.abspath(path.dirname(__file__)) + +# load __version__, __doc__, __author_, ... +exec(open(path.join(here, 'offlineimap', 'version.py')).read()) class TestCommand(Command): """runs the OLI testsuite""" @@ -42,6 +46,11 @@ class TestCommand(Command): pass def run(self): + # Import the test classes here instead of at the begin of the module + # to avoid an implicit dependency of the 'offlineimap' module + # in the setup.py (which may run *before* offlineimap is installed) + from test.OLItest import TextTestRunner, TestLoader, OLITestLib + logging.basicConfig(format='%(message)s') # set credentials and OfflineImap command to be executed: OLITestLib(cred_file='./test/credentials.conf', cmd='./offlineimap.py') @@ -49,19 +58,18 @@ class TestCommand(Command): #TODO: failfast does not seem to exist in python2.6? TextTestRunner(verbosity=2,failfast=True).run(suite) - setup(name = "offlineimap", - version = offlineimap.__version__, - description = offlineimap.__description__, - long_description = offlineimap.__description__, - author = offlineimap.__author__, - author_email = offlineimap.__author_email__, - url = offlineimap.__homepage__, + version = __version__, + description = __description__, + long_description = __description__, + author = __author__, + author_email = __author_email__, + url = __homepage__, packages = ['offlineimap', 'offlineimap.folder', 'offlineimap.repository', 'offlineimap.ui', 'offlineimap.utils'], scripts = ['bin/offlineimap'], - license = offlineimap.__copyright__ + \ + license = __copyright__ + \ ", Licensed under the GPL version 2", cmdclass = { 'test': TestCommand} )