From: Menno Smits Date: Tue, 7 Jul 2015 04:13:52 +0000 (+1200) Subject: Fixed version info read in setup.py so it works in Python 3 too X-Git-Tag: 1.0.0~1^2~57^2~21 X-Git-Url: http://git.khamidou.com/?a=commitdiff_plain;h=82b5f6bb3e8460ffcbf63528705c63a9b00fe830;p=imapclient.git Fixed version info read in setup.py so it works in Python 3 too --- diff --git a/setup.py b/setup.py index 323fe4e..b3fe664 100644 --- a/setup.py +++ b/setup.py @@ -14,14 +14,19 @@ use_setuptools() from setuptools import setup, find_packages from setuptools.command.test import test as TestCommand -# Read version info (without importing the whole imapclient package) -info = {} -execfile(path.join('imapclient', 'version.py'), {}, info) - MAJ_MIN = sys.version_info[:2] +IS_PY3 = MAJ_MIN >= (3, 0) IS_PY_26_OR_OLDER = MAJ_MIN <= (2, 6) IS_PY_34_OR_NEWER = MAJ_MIN >= (3, 4) +# Read version info +version_file = path.join('imapclient', 'version.py') +info = {} +if IS_PY3: + exec(open(version_file).read(), {}, info) +else: + execfile(version_file, {}, info) + desc = """\ IMAPClient is an easy-to-use, Pythonic and complete IMAP client library.