[Checkins] SVN: zope.interface/branches/regebro-python3/ Reverted to a functional state.

Lennart Regebro regebro at gmail.com
Sat Sep 19 17:10:17 EDT 2009


Log message for revision 104368:
  Reverted to a functional state.
  

Changed:
  A   zope.interface/branches/regebro-python3/build_ext_2.py
  U   zope.interface/branches/regebro-python3/setup.py
  U   zope.interface/branches/regebro-python3/src/zope/interface/tests/__init__.py

-=-
Copied: zope.interface/branches/regebro-python3/build_ext_2.py (from rev 103889, zope.interface/branches/regebro-python3/build_ext_2.py)
===================================================================
--- zope.interface/branches/regebro-python3/build_ext_2.py	                        (rev 0)
+++ zope.interface/branches/regebro-python3/build_ext_2.py	2009-09-19 21:10:16 UTC (rev 104368)
@@ -0,0 +1,38 @@
+import sys
+from distutils.errors import (CCompilerError, DistutilsExecError, 
+                              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
+       the building of C extensions to fail.
+    """
+    def run(self):
+        try:
+            build_ext.run(self)
+        
+        except DistutilsPlatformError, e:
+            self._unavailable(e)
+
+    def build_extension(self, ext):
+        try:
+            build_ext.build_extension(self, ext)
+        
+        except (CCompilerError, DistutilsExecError), e:
+            self._unavailable(e)
+
+    def _unavailable(self, e):
+        print >> sys.stderr, '*' * 80
+        print >> sys.stderr, """WARNING:
+
+        An optional code optimization (C extension) could not be compiled.
+
+        Optimizations for this package will not be available!"""
+        print >> sys.stderr
+        print >> sys.stderr, e
+        print >> sys.stderr, '*' * 80
+        
\ No newline at end of file

Modified: zope.interface/branches/regebro-python3/setup.py
===================================================================
--- zope.interface/branches/regebro-python3/setup.py	2009-09-18 22:43:32 UTC (rev 104367)
+++ zope.interface/branches/regebro-python3/setup.py	2009-09-19 21:10:16 UTC (rev 104368)
@@ -23,19 +23,15 @@
 
 import os, sys
 
-from distutils.errors import (CCompilerError, DistutilsExecError,
-                              DistutilsPlatformError)
+from distutils.errors import CCompilerError, DistutilsExecError, \
+                              DistutilsPlatformError
 
 try:
     from setuptools import setup, Extension, Feature
-    from setuptools.command.build_ext import build_ext
-    import setuptools
-
 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
-    from distutils.command.build_ext import build_ext
 
     if sys.version_info[:2] >= (2, 4):
         extra = dict(
@@ -68,22 +64,6 @@
         features = {'codeoptimization': codeoptimization}
         )
 
-
-try:
-    from setuptools import lib2to3_fixer_packages
-    setuptools.run_2to3 = True
-    # this is a bit kludgy since our fixers live inside ourselves,
-    # which we can't import since 2to3 has not been run yet
-    sys.path.append(os.path.join('src', 'zope', 'interface'))
-    lib2to3_fixer_packages.append('fixers')
-
-    #extra['convert_doctest_2to3'] = XXX
-except ImportError:
-    # either no setuptools or this setuptools is not distribute,
-    # 2to3 support will not be enabled
-    pass
-
-
 def read(*rnames):
     return open(os.path.join(os.path.dirname(__file__), *rnames)).read()
 
@@ -105,37 +85,26 @@
         '********\n'
         )
 
+try: # Zope 3 setuptools versions
+    from build_ext_3 import optional_build_ext
+    # This is Python 3. Setuptools is now required, and so is zope.fixers.
+    extra['install_requires'] = ['setuptools', 'zope.fixers' ],
+    extra['run_2to3'] = True
+    extra['convert_doctests_2to3'] = [
+        'src/zope/interface/README.ru.txt',
+        'src/zope/interface/README.txt',
+        'src/zope/interface/adapter.ru.txt',
+        'src/zope/interface/adapter.txt',
+        'src/zope/interface/human.ru.txt',
+        'src/zope/interface/human.txt',
+        'src/zope/interface/index.txt',
+        'src/zope/interface/verify.txt',
+        ]
+    extra['additional_2to3_fixers'] = ['zope.fixers']
 
-class optional_build_ext(build_ext):
-    """This class subclasses build_ext and allows
-       the building of C extensions to fail.
-    """
-    def run(self):
-        try:
-            build_ext.run(self)
-
-        except DistutilsPlatformError:
-            self._unavailable()
-
-    def build_extension(self, ext):
-        try:
-            build_ext.build_extension(self, ext)
-
-        except (CCompilerError, DistutilsExecError):
-            self._unavailable()
-
-    def _unavailable(self):
-        sys.stderr.write('*' * 80)
-        sys.stderr.write("""WARNING:
-
-        An optional code optimization (C extension) could not be compiled.
-
-        Optimizations for this package will not be available!
-        """)
-        sys.stderr.write(sys.exc_info()[1])
-        sys.stderr.write('*' * 80)
-
-
+except (ImportError, SyntaxError):
+    from build_ext_2 import optional_build_ext
+    
 setup(name='zope.interface',
       version = '3.5.3dev',
       url='http://pypi.python.org/pypi/zope.interface',
@@ -147,6 +116,7 @@
 
       packages = ['zope', 'zope.interface', 'zope.interface.tests'],
       package_dir = {'': 'src'},
-      cmdclass = {'build_ext': optional_build_ext},
+      cmdclass = {'build_ext': optional_build_ext,
+                  },
       test_suite = 'zope.interface.tests',
       **extra)

Modified: zope.interface/branches/regebro-python3/src/zope/interface/tests/__init__.py
===================================================================
--- zope.interface/branches/regebro-python3/src/zope/interface/tests/__init__.py	2009-09-18 22:43:32 UTC (rev 104367)
+++ zope.interface/branches/regebro-python3/src/zope/interface/tests/__init__.py	2009-09-19 21:10:16 UTC (rev 104368)
@@ -1,5 +1,3 @@
-#
-# This file is necessary to make this directory a package.
 import os
 import unittest
 



More information about the checkins mailing list