diff options
author | Gerhard Weis <gerhard.weis@gmx.com> | 2012-05-04 20:03:53 +1000 |
---|---|---|
committer | Gerhard Weis <gerhard.weis@gmx.com> | 2012-05-04 20:03:53 +1000 |
commit | 5a46ebb508aae26f7eaafbe18a0396bce43907a0 (patch) | |
tree | 248c314792f3678c536fe421753a4969bdc2e7b7 /setup.py | |
parent | f050a3d293a5bb9826df4955be7ba56a37333727 (diff) | |
download | isodate-5a46ebb508aae26f7eaafbe18a0396bce43907a0.tar.gz |
clean up setup.py for python2 and 3 compatibility (with and without setuptools available)
Diffstat (limited to 'setup.py')
-rw-r--r-- | setup.py | 15 |
1 files changed, 7 insertions, 8 deletions
@@ -26,22 +26,21 @@ # CONTRACT, STRICT LIABILITY, OR TORT ############################################################################## import os +import sys setupargs = {} try: - from distutils.command.build_py import build_py_2to3 as build_py -except ImportError: - # 2.x - from distutils.command.build_py import build_py - -try: from setuptools import setup setupargs['test_suite'] = 'isodate.tests.test_suite' - setupargs['use_2to3'] = True + if sys.version[0] == '3': + setupargs['use_2to3'] = True except ImportError: from distutils.core import setup - setupargs['cmdclass'] = {'build_py': build_py} + if sys.version[0] == '3': + from distutils.command.build_py import build_py_2to3 + setupargs['cmdclass'] = {'build_py': build_py_2to3} + def read(*rnames): return open(os.path.join(os.path.dirname(__file__), *rnames)).read() |