From b7d43c5a5d98ef2a00035071e6a8d1ee5665dd36 Mon Sep 17 00:00:00 2001 From: Ionel Cristian Maries Date: Fri, 10 Apr 2015 21:08:50 +0300 Subject: [PATCH] Add support for building proper wheels (universal and proper dependency evnironment markers for argparse/colorama if setuptools is new-ish). --HG-- branch : pytest-2.7 --- setup.cfg | 2 ++ setup.py | 22 ++++++++++++++++++---- 2 files changed, 20 insertions(+), 4 deletions(-) diff --git a/setup.cfg b/setup.cfg index 6ebbc65a5..770dd1fb2 100644 --- a/setup.cfg +++ b/setup.cfg @@ -6,3 +6,5 @@ all_files = 1 [upload_sphinx] upload-dir = doc/en/build/html +[bdist_wheel] +universal = 1 diff --git a/setup.py b/setup.py index 0e8b3509f..038e5f633 100644 --- a/setup.py +++ b/setup.py @@ -26,12 +26,25 @@ def get_version(): raise ValueError("could not read version") +def has_newish_setuptools(): + try: + import setuptools + return tuple(int(i) for i in str(setuptools.__version__).split('.')) > (0, 7) + except Exception: + return False + + def main(): install_requires = ['py>=1.4.25'] - if sys.version_info < (2, 7) or (3,) <= sys.version_info < (3, 2): - install_requires.append('argparse') - if sys.platform == 'win32': - install_requires.append('colorama') + extras_require = {} + if has_newish_setuptools(): + extras_require[':python_version=="2.6"'] = ['argparse'] + extras_require[':sys_platform=="win32"'] = ['colorama'] + else: + if sys.version_info < (2, 7) or (3,) <= sys.version_info < (3, 2): + install_requires.append('argparse') + if sys.platform == 'win32': + install_requires.append('colorama') setup( name='pytest', @@ -48,6 +61,7 @@ def main(): cmdclass={'test': PyTest}, # the following should be enabled for release install_requires=install_requires, + extras_require=extras_require, packages=['_pytest', '_pytest.assertion'], py_modules=['pytest'], zip_safe=False,