Commit 520fc2a6 authored by Gary Poster's avatar Gary Poster

fix the more troublesome problems with Python 2.7. Tests still fail after...

fix the more troublesome problems with Python 2.7.  Tests still fail after these changes, but only for trivial output-ordering issues.
parent 1e8e02f2
......@@ -144,7 +144,8 @@ def _get_system_paths(executable):
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 @@ def _get_module_file(executable, name):
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
......
......@@ -82,17 +82,30 @@ first.
... 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(
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment