From: SpotlightKid Date: Wed, 8 Oct 2014 13:19:53 +0000 (+0200) Subject: Put version info in new 'version' module to make it safe to exec it in 'setup.py... X-Git-Tag: 1.0.0~1^2~57^2~36 X-Git-Url: http://git.khamidou.com/?a=commitdiff_plain;h=5a8441b33e6508ceb84fe9a5d7b1361d562853f1;p=imapclient.git Put version info in new 'version' module to make it safe to exec it in 'setup.py' so we don't have to import the whole package there and create an hen-and-egg problem with the dependencies and also make sure that we don't accidentally get the version info from an installed version; add new dependencies to 'setup.py' --- diff --git a/imapclient/__init__.py b/imapclient/__init__.py index ce71052..19d961d 100644 --- a/imapclient/__init__.py +++ b/imapclient/__init__.py @@ -7,20 +7,7 @@ from __future__ import unicode_literals -version_info = (1, 0, 0, 'alpha') - -def _imapclient_version_string(vinfo): - major, minor, micro, releaselevel = vinfo - v = '%d.%d' % (major, minor) - if micro != 0: - v += '.%d' % micro - if releaselevel != 'final': - v += '-' + releaselevel - return v - -__version__ = _imapclient_version_string(version_info) -__author__ = 'Menno Smits ' - +from .version import author as __author__, version as __version__, version_info from .imapclient import * from .response_parser import * diff --git a/imapclient/version.py b/imapclient/version.py new file mode 100644 index 0000000..a5368ea --- /dev/null +++ b/imapclient/version.py @@ -0,0 +1,16 @@ +# -*- coding: utf-8 -*- + +version_info = (0, 11, 0, 'final') + +def _imapclient_version_string(vinfo): + major, minor, micro, releaselevel = vinfo + v = '%d.%d' % (major, minor) + if micro != 0: + v += '.%d' % micro + if releaselevel != 'final': + v += '-' + releaselevel + return v + +version = _imapclient_version_string(version_info) +author = 'Menno Smits' +author_email = 'menno@freshfoo.com' diff --git a/setup.py b/setup.py index 32a22f7..f9b3489 100644 --- a/setup.py +++ b/setup.py @@ -4,6 +4,7 @@ # Released subject to the New BSD License # Please see http://en.wikipedia.org/wiki/BSD_licenses +from os.path import join # bootstrap setuptools if necessary from ez_setup import use_setuptools @@ -13,8 +14,10 @@ from setuptools import setup, find_packages from setuptools.command.test import test as TestCommand import sys -import imapclient -version = imapclient.__version__ +# read meta-data from release.py +info = {} +metamod = join('imapclient', 'version.py') +exec(compile(open(metamod).read(), metamod, 'exec'), {}, info) MAJ_MIN = sys.version_info[:2] IS_PY_26_OR_OLDER = MAJ_MIN <= (2, 6) @@ -59,15 +62,20 @@ if IS_PY_26_OR_OLDER: test_deps.append('unittest2') setup(name='IMAPClient', - version=version, - author="Menno Smits", - author_email="menno@freshfoo.com", + version=info['version'], + author=info['author'], + author_email=info['author_email'], license="http://en.wikipedia.org/wiki/BSD_licenses", url="http://imapclient.freshfoo.com/", - download_url='http://freshfoo.com/projects/IMAPClient/IMAPClient-%s.zip' % version, + download_url='http://freshfoo.com/projects/IMAPClient/IMAPClient-%s.zip' % info['version'], packages=find_packages(), package_data=dict(imapclient=['examples/*.py']), tests_require=test_deps, + install_requires=[ + 'six', + 'pyopenssl', + 'service_identity' + ], description="Easy-to-use, Pythonic and complete IMAP client library", long_description=desc, classifiers=[