diff options
| author | Jason Madden <jamadden@gmail.com> | 2016-08-04 06:54:31 -0500 |
|---|---|---|
| committer | Jason Madden <jamadden@gmail.com> | 2016-08-04 06:54:31 -0500 |
| commit | 2081db253cacaeb44174455d2d574fa614a4ba23 (patch) | |
| tree | cac65947dec2925a26da0c038ff4a0f61ce9eee0 | |
| parent | b516fcad6c724c32f21ba055134985dbcd5ff18f (diff) | |
| download | zope-interface-setuptools-build.tar.gz | |
Make setuptools a hard dep of setup.pysetuptools-build
Fixes #13
Fixes #14
| -rw-r--r-- | CHANGES.rst | 3 | ||||
| -rw-r--r-- | setup.py | 98 |
2 files changed, 49 insertions, 52 deletions
diff --git a/CHANGES.rst b/CHANGES.rst index db52ae5..191f2fe 100644 --- a/CHANGES.rst +++ b/CHANGES.rst @@ -9,6 +9,9 @@ Changes be used together in ordered containers like BTrees. (https://github.com/zopefoundation/zope.interface/issues/42) +- Make ``setuptools`` a hard dependency of ``setup.py``. + (https://github.com/zopefoundation/zope.interface/issues/13) + 4.2.0 (2016-06-10) ------------------ @@ -23,14 +23,14 @@ import os import platform import sys +from setuptools import setup, Extension, Feature +from setuptools.command.build_ext import build_ext +from setuptools import find_packages + from distutils.errors import CCompilerError from distutils.errors import DistutilsExecError from distutils.errors import DistutilsPlatformError -try: - from setuptools.command.build_ext import build_ext -except ImportError: - from distutils.command.build_ext import build_ext class optional_build_ext(build_ext): """This class subclasses build_ext and allows @@ -59,49 +59,32 @@ class optional_build_ext(build_ext): print(e) print('*' * 80) -try: - from setuptools import setup, Extension, Feature -except ImportError: - # do we need to support plain distutils for building when even - # the package itself requires setuptools for installing? - from distutils.core import setup, Extension - extra = {} +codeoptimization_c = os.path.join('src', 'zope', 'interface', + '_zope_interface_coptimizations.c') +codeoptimization = Feature( + "Optional code optimizations", + standard=True, + ext_modules=[ + Extension( + "zope.interface._zope_interface_coptimizations", + [os.path.normcase(codeoptimization_c)] + ) + ]) +py_impl = getattr(platform, 'python_implementation', lambda: None) +is_pypy = py_impl() == 'PyPy' +is_jython = 'java' in sys.platform +is_pure = 'PURE_PYTHON' in os.environ + +# Jython cannot build the C optimizations, while on PyPy they are +# anti-optimizations (the C extension compatibility layer is known-slow, +# and defeats JIT opportunities). +if is_pypy or is_jython or is_pure: + features = {} else: - codeoptimization_c = os.path.join('src', 'zope', 'interface', - '_zope_interface_coptimizations.c') - codeoptimization = Feature( - "Optional code optimizations", - standard = True, - ext_modules = [Extension( - "zope.interface._zope_interface_coptimizations", - [os.path.normcase(codeoptimization_c)] - )]) - py_impl = getattr(platform, 'python_implementation', lambda: None) - is_pypy = py_impl() == 'PyPy' - is_jython = 'java' in sys.platform - is_pure = 'PURE_PYTHON' in os.environ + features = {'codeoptimization': codeoptimization} +tests_require = ['zope.event'] +testing_extras = tests_require + ['nose', 'coverage'] - # Jython cannot build the C optimizations, while on PyPy they are - # anti-optimizations (the C extension compatibility layer is known-slow, - # and defeats JIT opportunities). - if is_pypy or is_jython or is_pure: - features = {} - else: - features = {'codeoptimization': codeoptimization} - tests_require = ['zope.event'] - testing_extras = tests_require + ['nose', 'coverage'] - extra = dict( - namespace_packages=["zope"], - include_package_data = True, - zip_safe = False, - tests_require = tests_require, - install_requires = ['setuptools'], - extras_require={'docs': ['Sphinx', 'repoze.sphinx.autointerface'], - 'test': tests_require, - 'testing': testing_extras, - }, - features = features - ) def read(*rnames): with open(os.path.join(os.path.dirname(__file__), *rnames)) as f: @@ -138,10 +121,21 @@ setup(name='zope.interface', "Framework :: Zope3", "Topic :: Software Development :: Libraries :: Python Modules", ], - - packages = ['zope', 'zope.interface', 'zope.interface.tests'], - package_dir = {'': 'src'}, - cmdclass = {'build_ext': optional_build_ext, - }, - test_suite = 'zope.interface.tests', - **extra) + packages=find_packages('src'), + package_dir={'': 'src'}, + namespace_packages=["zope"], + cmdclass={ + 'build_ext': optional_build_ext, + }, + test_suite='zope.interface.tests', + include_package_data=True, + zip_safe=False, + tests_require=tests_require, + install_requires=['setuptools'], + extras_require={ + 'docs': ['Sphinx', 'repoze.sphinx.autointerface'], + 'test': tests_require, + 'testing': testing_extras, + }, + features=features, +) |
