[Checkins] SVN: zope.hookable/trunk/ Add support for PyPy.

Tres Seaver cvs-admin at zope.org
Mon Jun 4 16:52:20 UTC 2012


Log message for revision 126583:
  Add support for PyPy.
  

Changed:
  _U  zope.hookable/trunk/
  U   zope.hookable/trunk/CHANGES.txt
  U   zope.hookable/trunk/setup.py
  U   zope.hookable/trunk/src/zope/hookable/__init__.py
  U   zope.hookable/trunk/tox.ini

-=-
Modified: zope.hookable/trunk/CHANGES.txt
===================================================================
--- zope.hookable/trunk/CHANGES.txt	2012-06-04 16:52:13 UTC (rev 126582)
+++ zope.hookable/trunk/CHANGES.txt	2012-06-04 16:52:17 UTC (rev 126583)
@@ -4,6 +4,8 @@
 4.0.0 (unreleased)
 ##################
 
+- Added support for PyPy.
+
 - Added support for continuous integration using ``tox`` and ``jenkins``.
 
 - Added a pure-Python reference implementation.

Modified: zope.hookable/trunk/setup.py
===================================================================
--- zope.hookable/trunk/setup.py	2012-06-04 16:52:13 UTC (rev 126582)
+++ zope.hookable/trunk/setup.py	2012-06-04 16:52:17 UTC (rev 126583)
@@ -18,14 +18,35 @@
 ##############################################################################
 """Setup for zope.hookable package
 """
-
 import os
+import platform
 
-from setuptools import setup, find_packages, Extension
+from setuptools import setup, find_packages, Extension, Feature
 
 def read(*rnames):
     return open(os.path.join(os.path.dirname(__file__), *rnames)).read()
 
+Cwrapper = Feature(
+    "C wrapper",
+    standard = True,
+    ext_modules=[Extension("zope.hookable._zope_hookable",
+                            [os.path.join('src', 'zope', 'hookable',
+                                        "_zope_hookable.c")
+                            ],
+                            extra_compile_args=['-g']),
+                ],
+)
+py_impl = getattr(platform, 'python_implementation', lambda: None)
+is_pypy = py_impl() == 'PyPy'
+
+# 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:
+    features = {}
+else:
+    features = {'Cwrapper': Cwrapper}
+
 setup(name='zope.hookable',
       version = '4.0.0dev',
       url='http://svn.zope.org/zope.hookable',
@@ -44,9 +65,11 @@
         "Programming Language :: Python :: 2.7",
         "Programming Language :: Python :: 3",
         "Programming Language :: Python :: 3.2",
+        "Programming Language :: Python :: Implementation :: CPython",
+        "Programming Language :: Python :: Implementation :: PyPy",
         "Topic :: Software Development :: Libraries :: Python Modules",
       ],
-
+      features=features,
       packages=find_packages('src'),
       package_dir={'': 'src'},
       ext_modules=[Extension("zope.hookable._zope_hookable",

Modified: zope.hookable/trunk/src/zope/hookable/__init__.py
===================================================================
--- zope.hookable/trunk/src/zope/hookable/__init__.py	2012-06-04 16:52:13 UTC (rev 126582)
+++ zope.hookable/trunk/src/zope/hookable/__init__.py	2012-06-04 16:52:17 UTC (rev 126583)
@@ -41,4 +41,7 @@
 
 hookable = _py_hookable
 
-from ._zope_hookable import hookable
+try:
+    from ._zope_hookable import hookable
+except ImportError:
+    pass

Modified: zope.hookable/trunk/tox.ini
===================================================================
--- zope.hookable/trunk/tox.ini	2012-06-04 16:52:13 UTC (rev 126582)
+++ zope.hookable/trunk/tox.ini	2012-06-04 16:52:17 UTC (rev 126583)
@@ -3,7 +3,7 @@
 # Jython support pending 2.7 support, due 2012-07-15 or so.  See:
 # http://fwierzbicki.blogspot.com/2012/03/adconion-to-fund-jython-27.html
 #   py26,py27,py32,jython,pypy,coverage
-    py26,py27,py32,coverage,docs
+    py26,py27,py32,pypy,coverage,docs
 
 [testenv]
 commands = 



More information about the checkins mailing list