Index: twisted/python/versions.py
===================================================================
--- twisted/python/versions.py	(Revision 28089)
+++ twisted/python/versions.py	(Arbeitskopie)
@@ -209,7 +209,7 @@
             formatFile = os.path.join(svn, 'format')
             if os.path.exists(formatFile):
                 # It looks like a less-than-version-10 working copy.
-                format = file(formatFile).read().strip()
+                format = open(formatFile).read().strip()
                 parser = getattr(self, '_parseSVNEntries_' + format, None)
             else:
                 # It looks like a version-10-or-greater working copy, which
@@ -220,7 +220,7 @@
                 return 'Unknown'
 
             entriesFile = os.path.join(svn, 'entries')
-            entries = file(entriesFile)
+            entries = open(entriesFile)
             try:
                 try:
                     return parser(entries)
Index: twisted/python/dist.py
===================================================================
--- twisted/python/dist.py	(Revision 28089)
+++ twisted/python/dist.py	(Arbeitskopie)
@@ -12,6 +12,11 @@
 from distutils import core
 from distutils.core import Extension
 
+try:
+    execfile
+except NameError:
+    from twisted.python.compat3k import execfile
+
 twisted_subprojects = ["conch", "lore", "mail", "names",
                        "news", "pair", "runner", "web", "web2",
                        "words", "vfs"]
@@ -277,11 +282,8 @@
         for f in os.listdir(self.build_dir):
             fpath=os.path.join(self.build_dir, f)
             if not fpath.endswith(".py"):
-                try:
+                if os.path.exists(fpath + ".py"):
                     os.unlink(fpath + ".py")
-                except EnvironmentError, e:
-                    if e.args[1]=='No such file or directory':
-                        pass
                 os.rename(fpath, fpath + ".py")
 
 
Index: twisted/python/compat3k.py
===================================================================
--- twisted/python/compat3k.py	(Revision 0)
+++ twisted/python/compat3k.py	(Revision 0)
@@ -0,0 +1,2 @@
+def execfile(filename, *args):
+    return exec(compile(open(filename).read(), filename, 'exec'), *args)

Eigenschaftsänderungen: twisted/python/compat3k.py
___________________________________________________________________
Hinzugefügt: svn:keywords
   + Id
Hinzugefügt: svn:eol-style
   + native

Index: twisted/python/compat.py
===================================================================
--- twisted/python/compat.py	(Revision 28089)
+++ twisted/python/compat.py	(Arbeitskopie)
@@ -135,12 +135,12 @@
                   'set_connect_state', 'set_accept_state',
                   'connect_ex', 'sendall'):
 
-            exec """def %s(self, *args):
+            exec("""def %s(self, *args):
                 self._lock.acquire()
                 try:
                     return apply(self._ssl_conn.%s, args)
                 finally:
-                    self._lock.release()\n""" % (f, f)
+                    self._lock.release()\n""" % (f, f))
 sys.modules['OpenSSL.tsafe'] = tsafe
 
 import operator
Index: setup.py
===================================================================
--- setup.py	(Revision 28089)
+++ setup.py	(Arbeitskopie)
@@ -15,6 +15,10 @@
 
 import sys, os
 
+try:
+    execfile
+except NameError:
+    from twisted.python.compat3k import execfile
 
 def getExtensions():
     """
@@ -81,14 +85,23 @@
         try:
             list(parse_requirements(requirements))
         except:
-            print """You seem to be running a very old version of setuptools.
+            print("""You seem to be running a very old version of setuptools.
 This version of setuptools has a bug parsing dependencies, so automatic
 dependency resolution is disabled.
-"""
+""")
         else:
             setup_args['install_requires'] = requirements
         setup_args['include_package_data'] = True
         setup_args['zip_safe'] = False
+        if getattr(setuptools, '_distribute', False): # set to True in distribute
+            setup_args['use_2to3'] = True
+            if (3,1) <= sys.version_info < (3,2):
+                # fix_callable chokes on twisted/trial/test/test_pyunitcompat.py
+                # reported as http://bugs.python.org/issue7810
+                from distutils.util import Mixin2to3
+                import lib2to3.refactor
+                Mixin2to3.fixer_names = lib2to3.refactor.get_fixers_from_package('lib2to3.fixes')
+                Mixin2to3.fixer_names.remove('lib2to3.fixes.fix_callable')
     setup(**setup_args)
 
 
