[Checkins] SVN: zope.i18nmessageid/trunk/ - Don't attempt to compile C extensions on PyPy or Jython.

Chris McDonough chrism at plope.com
Fri Jul 15 04:29:22 EDT 2011


Log message for revision 122256:
  - Don't attempt to compile C extensions on PyPy or Jython.
  
  - Add a tox.ini (see http://tox.readthedocs.org/en/latest/) for easier
    automated testing.
  
  

Changed:
  _U  zope.i18nmessageid/trunk/
  U   zope.i18nmessageid/trunk/CHANGES.txt
  U   zope.i18nmessageid/trunk/setup.py
  _U  zope.i18nmessageid/trunk/src/zope/
  _U  zope.i18nmessageid/trunk/src/zope/i18nmessageid/
  A   zope.i18nmessageid/trunk/tox.ini

-=-

Property changes on: zope.i18nmessageid/trunk
___________________________________________________________________
Modified: svn:ignore
   - bin
build
dist
lib
develop-eggs
eggs
parts
.installed.cfg
.coverage

   + bin
build
dist
lib
develop-eggs
eggs
parts
.installed.cfg
.coverage
.tox


Modified: zope.i18nmessageid/trunk/CHANGES.txt
===================================================================
--- zope.i18nmessageid/trunk/CHANGES.txt	2011-07-15 06:30:49 UTC (rev 122255)
+++ zope.i18nmessageid/trunk/CHANGES.txt	2011-07-15 08:29:22 UTC (rev 122256)
@@ -7,6 +7,11 @@
 
 - Python 3 support.
 
+- Don't attempt to compile C extensions on PyPy or Jython.
+
+- Add a tox.ini (see http://tox.readthedocs.org/en/latest/) for easier
+  automated testing.
+
 3.5.3 (2010-08-10)
 ------------------
 

Modified: zope.i18nmessageid/trunk/setup.py
===================================================================
--- zope.i18nmessageid/trunk/setup.py	2011-07-15 06:30:49 UTC (rev 122255)
+++ zope.i18nmessageid/trunk/setup.py	2011-07-15 08:29:22 UTC (rev 122256)
@@ -22,20 +22,42 @@
 import os
 import sys
 
-from setuptools import setup, find_packages, Extension
+from setuptools import setup, find_packages, Extension, Feature
 from distutils.command.build_ext import build_ext
 from distutils.errors import CCompilerError
 from distutils.errors import DistutilsExecError
 from distutils.errors import DistutilsPlatformError
+import platform
 
+py_impl = getattr(platform, 'python_implementation', lambda: None)
+is_pypy = py_impl() == 'PyPy'
+is_jython = 'java' in sys.platform
+
+codeoptimization_c = os.path.join('src', 'zope', 'i18nmessageid',
+                                  "_zope_i18nmessageid_message.c")
+codeoptimization = Feature(
+    "Optional code optimizations",
+    standard = True,
+    ext_modules = [Extension(
+        "zope.i18nmessageid._zope_i18nmessageid_message",
+        [os.path.normcase(codeoptimization_c)]
+        )])
+
+if is_pypy or is_jython:
+    # 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).
+    extra = {}
+else:
+    extra = {'features':{'codeoptimization':codeoptimization}}
+
 if sys.version_info >= (3,):
-    extra = dict(use_2to3 = True,
+    extra.update(dict(use_2to3 = True,
                  convert_2to3_doctests = [
                      'src/zope/i18nmessageid/messages.txt',
                      ],
+                      )
                  )
-else:
-    extra = {}
 
 def read(*rnames):
     return open(os.path.join(os.path.dirname(__file__), *rnames)).read()
@@ -111,11 +133,6 @@
     url='http://pypi.python.org/pypi/zope.i18nmessageid',
     packages=find_packages('src'),
     package_dir = {'': 'src'},
-    ext_modules=[
-        Extension("zope.i18nmessageid._zope_i18nmessageid_message",
-                  [os.path.join('src', 'zope', 'i18nmessageid',
-                                "_zope_i18nmessageid_message.c") ]),
-        ],
     namespace_packages=['zope',],
     install_requires=['setuptools'],
     include_package_data = True,


Property changes on: zope.i18nmessageid/trunk/src/zope
___________________________________________________________________
Added: svn:ignore
   + __pycache__



Property changes on: zope.i18nmessageid/trunk/src/zope/i18nmessageid
___________________________________________________________________
Modified: svn:ignore
   - *.so

   + *.so
__pycache__



Added: zope.i18nmessageid/trunk/tox.ini
===================================================================
--- zope.i18nmessageid/trunk/tox.ini	                        (rev 0)
+++ zope.i18nmessageid/trunk/tox.ini	2011-07-15 08:29:22 UTC (rev 122256)
@@ -0,0 +1,11 @@
+[tox]
+envlist = 
+    py24,py25,py26,py27,py32,jython,pypy
+
+[testenv]
+commands = 
+    python setup.py test -q
+
+[testenv:jython]
+commands = 
+   jython setup.py test -q



More information about the checkins mailing list