Move out pkg attributes from __init__.py
The setup.py uses the version, author and others attributes as metadata for the python package. The setup read them from offlineimap/__init__.py doing an import of the module first. Unfortunately the import also try to import all the dependencies of offlineimap which may not be installed by the time. See #661. Moving out the attributes in a separated module allows to be imported by setup.py whitout needing to import the whole offlineimap. The import of test.OLItest has the same limitation. In this case the import was delayed until the real test case run is executed avoiding again loading offlineimap from the begin. Signed-off-by: Martin Di Paola <martinp.dipaola@gmail.com> Signed-off-by: Nicolas Sebrecht <nicolas.s-dev@laposte.net>
This commit is contained in:
parent
7531ac4640
commit
8599cab2ab
|
@ -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
|
||||
|
|
|
@ -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__
|
28
setup.py
28
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}
|
||||
)
|
||||
|
|
Loading…
Reference in New Issue