Skip to content

Commit

Permalink
Don't even attempt to build the C modules on PyPy
Browse files Browse the repository at this point in the history
  • Loading branch information
jamadden committed Feb 19, 2014
1 parent a920e38 commit bfbb147
Showing 1 changed file with 19 additions and 5 deletions.
24 changes: 19 additions & 5 deletions setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,8 @@
"""Setup for zope.container package
"""
import os
import platform
import sys
from setuptools import setup, find_packages, Extension

def read(*rnames):
Expand All @@ -39,6 +41,22 @@ def alltests():
suites = list(zope.testrunner.find.find_suites(options))
return unittest.TestSuite(suites)

# PyPy cannot correctly build the C optimizations, and even if it
# could they would be anti-optimizations (the C extension
# compatibility layer is known-slow, and defeats JIT opportunities).
py_impl = getattr(platform, 'python_implementation', lambda: None)
pure_python = os.environ.get('PURE_PYTHON', False)
is_pypy = py_impl() == 'PyPy'

if pure_python or is_pypy:
ext_modules = []
else:
ext_modules = [Extension("zope.container._zope_container_contained",
[os.path.join("src", "zope", "container",
"_zope_container_contained.c")
], include_dirs=['include']),
]

setup(name='zope.container',
version='4.0.0a4.dev0',
author='Zope Foundation and Contributors',
Expand Down Expand Up @@ -77,11 +95,7 @@ def alltests():
packages=find_packages('src'),
package_dir = {'': 'src'},
namespace_packages=['zope'],
ext_modules=[Extension("zope.container._zope_container_contained",
[os.path.join("src", "zope", "container",
"_zope_container_contained.c")
], include_dirs=['include']),
],
ext_modules=ext_modules,
extras_require=dict(
test=['zope.testing', 'zope.testrunner'
],
Expand Down

0 comments on commit bfbb147

Please sign in to comment.