diff options
| author | Tres Seaver <tseaver@palladion.com> | 2011-07-05 19:13:40 +0000 |
|---|---|---|
| committer | Tres Seaver <tseaver@palladion.com> | 2011-07-05 19:13:40 +0000 |
| commit | 76fe333069becd42ab62fcb3a14eba921dfde474 (patch) | |
| tree | 3be5ba2a7fa9e6713db0dac9fa09fe79ad97987b | |
| parent | 1c333b2fe646ff9ee039e98290d5645950b11f6c (diff) | |
| download | zope-interface-76fe333069becd42ab62fcb3a14eba921dfde474.tar.gz | |
Under PyPy, 'zope.interface' should not build its C extension.
PyPy's C extension compatibility layer is known to be slow, and defeats
JIT optimization opportunities.
Also, prevent attempting to build the extension under Jython, where it is
flat impossible.
Fixes LP #804832.
| -rw-r--r-- | CHANGES.txt | 3 | ||||
| -rw-r--r-- | setup.py | 36 |
2 files changed, 26 insertions, 13 deletions
diff --git a/CHANGES.txt b/CHANGES.txt index 1ddaf1d..e0d9756 100644 --- a/CHANGES.txt +++ b/CHANGES.txt @@ -4,7 +4,8 @@ 3.6.5 (unreleased) ------------------ -- TBD +- LP #804832: Under PyPy, ``zope.interface`` should not build its C + extension. Also, prevent attempting to build it under Jython. 3.6.4 (2011-07-04) ------------------ @@ -19,7 +19,9 @@ """Setup for zope.interface package """ -import os, sys +import os +import platform +import sys try: from setuptools import setup, Extension, Feature @@ -39,16 +41,26 @@ except ImportError: extra = {} else: - codeoptimization = Feature("Optional code optimizations", - standard = True, - ext_modules = [Extension( - "zope.interface._zope_interface_coptimizations", - [os.path.normcase( - os.path.join('src', 'zope', - 'interface', - '_zope_interface_coptimizations.c') - )] - )]) + 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 + + # 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: + features = {} + else: + features = {'codeoptimization': codeoptimization} extra = dict( namespace_packages=["zope"], include_package_data = True, @@ -56,7 +68,7 @@ else: tests_require = [], install_requires = ['setuptools'], extras_require={'docs': ['z3c.recipe.sphinxdoc']}, - features = {'codeoptimization': codeoptimization} + features = features ) def read(*rnames): |
