[pypy-svn] r75433 - in pypy/branch/sys-prefix: lib/pypy1.2/lib-python/modified-2.5.2/distutils lib/pypy1.2/lib-python/modified-2.5.2/distutils/command lib/pypy1.2/lib-python/modified-2.5.2/test pypy pypy/module/sys

antocuni at codespeak.net antocuni at codespeak.net
Thu Jun 17 13:35:50 CEST 2010


Author: antocuni
Date: Thu Jun 17 13:35:46 2010
New Revision: 75433

Modified:
   pypy/branch/sys-prefix/lib/pypy1.2/lib-python/modified-2.5.2/distutils/command/build_ext.py
   pypy/branch/sys-prefix/lib/pypy1.2/lib-python/modified-2.5.2/distutils/command/install.py
   pypy/branch/sys-prefix/lib/pypy1.2/lib-python/modified-2.5.2/distutils/sysconfig_pypy.py
   pypy/branch/sys-prefix/lib/pypy1.2/lib-python/modified-2.5.2/test/regrtest.py
   pypy/branch/sys-prefix/lib/pypy1.2/lib-python/modified-2.5.2/test/test_doctest.py
   pypy/branch/sys-prefix/lib/pypy1.2/lib-python/modified-2.5.2/test/test_sys.py
   pypy/branch/sys-prefix/pypy/module/sys/__init__.py
   pypy/branch/sys-prefix/pypy/module/sys/state.py
   pypy/branch/sys-prefix/pypy/test_all.py
Log:
This is a (hopefully temporary) hack.

Currently buildbot assumes that lib-python is under trunk/ and invokes
lib-python tests like this:

    python pypy/test_all.py --pypy=pypy/translator/goal/pypy-c \
                            --resultlog=cpython.log lib-python

However, now lib-python is under lib/pypy1.2/lib-python.  We cannot just
change buildbot, as it would break all the other current branches, so
instead we replace lib-python with the correct path here.



Modified: pypy/branch/sys-prefix/lib/pypy1.2/lib-python/modified-2.5.2/distutils/command/build_ext.py
==============================================================================
--- pypy/branch/sys-prefix/lib/pypy1.2/lib-python/modified-2.5.2/distutils/command/build_ext.py	(original)
+++ pypy/branch/sys-prefix/lib/pypy1.2/lib-python/modified-2.5.2/distutils/command/build_ext.py	Thu Jun 17 13:35:46 2010
@@ -167,7 +167,7 @@
         # for Release and Debug builds.
         # also Python's library directory must be appended to library_dirs
         if os.name == 'nt':
-            self.library_dirs.append(os.path.join(sys.pypy_prefix, 'pypy', '_interfaces'))
+            self.library_dirs.append(os.path.join(sys.prefix, 'pypy', '_interfaces'))
             if self.debug:
                 self.build_temp = os.path.join(self.build_temp, "Debug")
             else:

Modified: pypy/branch/sys-prefix/lib/pypy1.2/lib-python/modified-2.5.2/distutils/command/install.py
==============================================================================
--- pypy/branch/sys-prefix/lib/pypy1.2/lib-python/modified-2.5.2/distutils/command/install.py	(original)
+++ pypy/branch/sys-prefix/lib/pypy1.2/lib-python/modified-2.5.2/distutils/command/install.py	Thu Jun 17 13:35:46 2010
@@ -392,13 +392,9 @@
                 if self.exec_prefix is not None:
                     raise DistutilsOptionError, \
                           "must not supply exec-prefix without prefix"
-
-                if hasattr(sys, 'pypy_prefix'):
-                    self.prefix = os.path.normpath(sys.pypy_prefix)
-                    self.exec_prefix = self.prefix
-                else:
-                    self.prefix = os.path.normpath(sys.prefix)
-                    self.exec_prefix = os.path.normpath(sys.exec_prefix)
+                
+                self.prefix = os.path.normpath(sys.prefix)
+                self.exec_prefix = os.path.normpath(sys.exec_prefix)
 
             else:
                 if self.exec_prefix is None:
@@ -418,10 +414,7 @@
             self.select_scheme("unix_home")
         else:
             if self.prefix is None:
-                if hasattr(sys, 'pypy_prefix'):
-                    self.prefix = os.path.normpath(sys.pypy_prefix)
-                else:
-                    self.prefix = os.path.normpath(sys.prefix)
+                self.prefix = os.path.normpath(sys.prefix)
 
             self.install_base = self.install_platbase = self.prefix
             try:
@@ -435,7 +428,7 @@
 
     def select_scheme (self, name):
         # it's the caller's problem if they supply a bad name!
-        if hasattr(sys, 'pypy_prefix'):
+        if hasattr(sys, 'pypy_version_info'):
             name = 'pypy'
         scheme = INSTALL_SCHEMES[name]
         for key in SCHEME_KEYS:

Modified: pypy/branch/sys-prefix/lib/pypy1.2/lib-python/modified-2.5.2/distutils/sysconfig_pypy.py
==============================================================================
--- pypy/branch/sys-prefix/lib/pypy1.2/lib-python/modified-2.5.2/distutils/sysconfig_pypy.py	(original)
+++ pypy/branch/sys-prefix/lib/pypy1.2/lib-python/modified-2.5.2/distutils/sysconfig_pypy.py	Thu Jun 17 13:35:46 2010
@@ -7,15 +7,15 @@
 from distutils.errors import DistutilsPlatformError
 
 
-PYPY_PREFIX = os.path.normpath(sys.pypy_prefix)
+PREFIX = os.path.normpath(sys.prefix)
 python_build = False
 
 
 def get_python_inc(plat_specific=0, prefix=None):
     from os.path import join as j
     if plat_specific:
-        return j(sys.pypy_prefix, "pypy", "_interfaces")
-    return j(sys.pypy_prefix, 'pypy', 'module', 'cpyext', 'include')
+        return j(sys.prefix, "pypy", "_interfaces")
+    return j(sys.prefix, 'pypy', 'module', 'cpyext', 'include')
 
 def get_python_version():
     """Return a string containing the major and minor Python version,
@@ -43,7 +43,7 @@
         raise DistutilsPlatformError(
             "calls to get_python_lib(standard_lib=1) cannot succeed")
     if prefix is None:
-        prefix = PYPY_PREFIX
+        prefix = PREFIX
     pypylib = 'pypy%d.%d' % sys.pypy_version_info[:2]
     return os.path.join(prefix, 'lib', pypylib, 'site-packages')
 

Modified: pypy/branch/sys-prefix/lib/pypy1.2/lib-python/modified-2.5.2/test/regrtest.py
==============================================================================
--- pypy/branch/sys-prefix/lib/pypy1.2/lib-python/modified-2.5.2/test/regrtest.py	(original)
+++ pypy/branch/sys-prefix/lib/pypy1.2/lib-python/modified-2.5.2/test/regrtest.py	Thu Jun 17 13:35:46 2010
@@ -348,11 +348,8 @@
         random.shuffle(tests)
     if trace:
         import trace
-        if hasattr(sys, 'prefix'):
-            ignoredirs = [sys.prefix, sys.exec_prefix]
-        else:
-            ignoredirs = [sys.pypy_prefix]     # PyPy only
-        tracer = trace.Trace(ignoredirs=ignoredirs, trace=False, count=True)
+        tracer = trace.Trace(ignoredirs=[sys.prefix, sys.exec_prefix],
+                             trace=False, count=True)
     test_support.verbose = verbose      # Tell tests to be moderately quiet
     test_support.use_resources = use_resources
     save_modules = sys.modules.keys()

Modified: pypy/branch/sys-prefix/lib/pypy1.2/lib-python/modified-2.5.2/test/test_doctest.py
==============================================================================
--- pypy/branch/sys-prefix/lib/pypy1.2/lib-python/modified-2.5.2/test/test_doctest.py	(original)
+++ pypy/branch/sys-prefix/lib/pypy1.2/lib-python/modified-2.5.2/test/test_doctest.py	Thu Jun 17 13:35:46 2010
@@ -2422,11 +2422,8 @@
 
 import trace, sys, re, StringIO
 def test_coverage(coverdir):
-    if hasattr(sys, 'prefix'):
-        ignoredirs = [sys.prefix, sys.exec_prefix]
-    else:
-        ignoredirs = [sys.pypy_prefix]     # PyPy only
-    tracer = trace.Trace(ignoredirs=ignoredirs, trace=0, count=1)
+    tracer = trace.Trace(ignoredirs=[sys.prefix, sys.exec_prefix,],
+                         trace=0, count=1)
     tracer.run('reload(doctest); test_main()')
     r = tracer.results()
     print 'Writing coverage results...'

Modified: pypy/branch/sys-prefix/lib/pypy1.2/lib-python/modified-2.5.2/test/test_sys.py
==============================================================================
--- pypy/branch/sys-prefix/lib/pypy1.2/lib-python/modified-2.5.2/test/test_sys.py	(original)
+++ pypy/branch/sys-prefix/lib/pypy1.2/lib-python/modified-2.5.2/test/test_sys.py	Thu Jun 17 13:35:46 2010
@@ -334,11 +334,8 @@
         if test.test_support.have_unicode:
             self.assert_(isinstance(sys.maxunicode, int))
         self.assert_(isinstance(sys.platform, basestring))
-        if hasattr(sys, 'prefix'):
-            self.assert_(isinstance(sys.prefix, basestring))
-            self.assert_(isinstance(sys.exec_prefix, basestring))
-        else:
-            self.assert_(isinstance(sys.pypy_prefix, basestring))  # PyPy only
+        self.assert_(isinstance(sys.prefix, basestring))
+        self.assert_(isinstance(sys.exec_prefix, basestring))
         self.assert_(isinstance(sys.version, basestring))
         vi = sys.version_info
         self.assert_(isinstance(vi, tuple))

Modified: pypy/branch/sys-prefix/pypy/module/sys/__init__.py
==============================================================================
--- pypy/branch/sys-prefix/pypy/module/sys/__init__.py	(original)
+++ pypy/branch/sys-prefix/pypy/module/sys/__init__.py	Thu Jun 17 13:35:46 2010
@@ -29,9 +29,8 @@
         'stderr'                : 'state.getio(space).w_stderr',
         '__stderr__'            : 'state.getio(space).w_stderr',
         'pypy_objspaceclass'    : 'space.wrap(repr(space))',
-        #'pypy_prefix': added by pypy_initial_path() when it succeeds, pointing
-        # to the trunk of a checkout or to the dir /usr/share/pypy-1.1 .
-
+        #'prefix'               : # added by pypy_initial_path() when it 
+        #'exec_prefix'          : # succeeds, pointing to trunk or /usr
         'path'                  : 'state.get(space).w_path', 
         'modules'               : 'state.get(space).w_modules', 
         'argv'                  : 'state.get(space).w_argv', 

Modified: pypy/branch/sys-prefix/pypy/module/sys/state.py
==============================================================================
--- pypy/branch/sys-prefix/pypy/module/sys/state.py	(original)
+++ pypy/branch/sys-prefix/pypy/module/sys/state.py	Thu Jun 17 13:35:46 2010
@@ -64,8 +64,6 @@
     except OSError:
         return space.w_None
     else:
-        space.setitem(space.sys.w_dict, space.wrap('pypy_prefix'), # XXX remove me
-                                        space.wrap(srcdir))
         space.setitem(space.sys.w_dict, space.wrap('prefix'),
                                         space.wrap(srcdir))
         space.setitem(space.sys.w_dict, space.wrap('exec_prefix'),

Modified: pypy/branch/sys-prefix/pypy/test_all.py
==============================================================================
--- pypy/branch/sys-prefix/pypy/test_all.py	(original)
+++ pypy/branch/sys-prefix/pypy/test_all.py	Thu Jun 17 13:35:46 2010
@@ -1,6 +1,34 @@
 #! /usr/bin/env python
 
+def fix_lib_python_path():
+    """
+    This is a (hopefully temporary) hack.
+
+    Currently buildbot assumes that lib-python is under trunk/ and invokes
+    lib-python tests like this:
+    
+        python pypy/test_all.py --pypy=pypy/translator/goal/pypy-c \
+                                --resultlog=cpython.log lib-python
+
+    However, now lib-python is under lib/pypy1.2/lib-python.  We cannot just
+    change buildbot, as it would break all the other current branches, so
+    instead we replace lib-python with the correct path here.
+    """
+    import sys
+    from pypy.tool.lib_pypy import LIB_PYTHON
+    if sys.argv and sys.argv[-1].endswith('lib-python'):
+        libpython = py.path.local(sys.argv[-1])
+        if libpython.check(dir=True):
+            # the argument passed to the command line actually exists, so no
+            # need to patch it
+            return
+        else:
+            # patch it with the correct path
+            sys.argv[-1] = str(LIB_PYTHON)
+
+    
 if __name__ == '__main__':
     import tool.autopath
     import py
+    fix_lib_python_path()
     py.cmdline.pytest()



More information about the Pypy-commit mailing list