[Checkins] SVN: zc.buildout/branches/gary-betafix/src/zc/buildout/ fix the more troublesome problems with Python 2.7. Tests still fail after these changes, but only for trivial output-ordering issues.

Gary Poster gary.poster at canonical.com
Tue Jul 20 19:07:14 EDT 2010


Log message for revision 114881:
  fix the more troublesome problems with Python 2.7.  Tests still fail after these changes, but only for trivial output-ordering issues.

Changed:
  U   zc.buildout/branches/gary-betafix/src/zc/buildout/easy_install.py
  U   zc.buildout/branches/gary-betafix/src/zc/buildout/virtualenv.txt

-=-
Modified: zc.buildout/branches/gary-betafix/src/zc/buildout/easy_install.py
===================================================================
--- zc.buildout/branches/gary-betafix/src/zc/buildout/easy_install.py	2010-07-20 16:12:36 UTC (rev 114880)
+++ zc.buildout/branches/gary-betafix/src/zc/buildout/easy_install.py	2010-07-20 23:07:13 UTC (rev 114881)
@@ -144,7 +144,8 @@
     return (stdlib, site_paths)
 
 def _get_version_info(executable):
-    cmd = [executable, '-Sc', 'import sys; print repr(sys.version_info)']
+    cmd = [executable, '-Sc',
+           'import sys; print(repr(tuple(x for x in sys.version_info)))']
     _proc = subprocess.Popen(
         cmd, stdout=subprocess.PIPE, stderr=subprocess.PIPE)
     stdout, stderr = _proc.communicate();
@@ -1541,7 +1542,7 @@
     cmd = [executable, "-Sc",
            "import imp; "
            "fp, path, desc = imp.find_module(%r); "
-           "fp.close; "
+           "fp.close(); "
            "print path" % (name,)]
     env = os.environ.copy()
     # We need to make sure that PYTHONPATH, which will often be set to

Modified: zc.buildout/branches/gary-betafix/src/zc/buildout/virtualenv.txt
===================================================================
--- zc.buildout/branches/gary-betafix/src/zc/buildout/virtualenv.txt	2010-07-20 16:12:36 UTC (rev 114880)
+++ zc.buildout/branches/gary-betafix/src/zc/buildout/virtualenv.txt	2010-07-20 23:07:13 UTC (rev 114881)
@@ -82,17 +82,30 @@
     ... sys.executable = %r
     ... if 'BROKEN_DASH_S' in os.environ:
     ...     class ImportHook:
-    ...         @staticmethod
-    ...         def find_module(fullname, path=None):
+    ...         site = None
+    ...
+    ...         @classmethod
+    ...         def find_module(klass, fullname, path=None):
+    ...             if klass.site is None and 'site' in sys.modules:
+    ...                 # Pop site out of sys.modules. This will be a
+    ...                 # close-enough approximation of site not being
+    ...                 # loaded for our tests--it lets us provoke the
+    ...                 # right errors when the fixes are absent, and
+    ...                 # works well enough when the fixes are present.
+    ...                 klass.site = sys.modules.pop('site')
     ...             if fullname == 'ConfigParser':
-    ...                 raise ImportError()
+    ...                 raise ImportError(fullname)
+    ...             elif fullname == 'site':
+    ...                 # Keep the site module from being processed twice.
+    ...                 return klass
     ...
+    ...         @classmethod
+    ...         def load_module(klass, fullname):
+    ...             if fullname == 'site':
+    ...                 return klass.site
+    ...             raise ImportError(fullname)
+    ...
     ...     sys.meta_path.append(ImportHook)
-    ...     sys.modules.pop('site', None) # Keeps site out of sys.modules.
-    ...     # This will be a close-enough approximation of site not being
-    ...     # loaded for our tests--it lets us provoke the right errors when
-    ...     # the fixes are absent, and works well enough when the fixes are
-    ...     # present.
     ... ''' % (py_path,))
     >>> sitecustomize_file.close()
     >>> print call_py(



More information about the checkins mailing list