[pypy-svn] r75631 - in pypy/trunk: lib-python/modified-2.5.2/distutils pypy/module/sys pypy/module/sys/test pypy/translator/goal/test2

antocuni at codespeak.net antocuni at codespeak.net
Mon Jun 28 10:49:54 CEST 2010


Author: antocuni
Date: Mon Jun 28 10:49:52 2010
New Revision: 75631

Modified:
   pypy/trunk/lib-python/modified-2.5.2/distutils/sysconfig_pypy.py
   pypy/trunk/pypy/module/sys/state.py
   pypy/trunk/pypy/module/sys/test/test_initialpath.py
   pypy/trunk/pypy/translator/goal/test2/test_app_main.py
Log:
remove the possibility of putting the libraries in $PREFIX/lib/pypy1.3/*.  It
is too hard to keep in sync all the various tool that needs to know where the
directories are, such as distutils, virtualenv, etc.

Now the only supported hierarchy is the one adopted in the svn checkout (i.e.,
lib-python, lib_pypy and site-packages needs to be on some parent directory
that the one where pypy-c resides)



Modified: pypy/trunk/lib-python/modified-2.5.2/distutils/sysconfig_pypy.py
==============================================================================
--- pypy/trunk/lib-python/modified-2.5.2/distutils/sysconfig_pypy.py	(original)
+++ pypy/trunk/lib-python/modified-2.5.2/distutils/sysconfig_pypy.py	Mon Jun 28 10:49:52 2010
@@ -47,11 +47,7 @@
             "calls to get_python_lib(standard_lib=1) cannot succeed")
     if prefix is None:
         prefix = PREFIX
-    pypylib = os.path.join(prefix, 'lib', 'pypy%d.%d' % sys.pypy_version_info[:2])
-    if os.path.exists(pypylib):
-        return os.path.join(pypylib, 'site-packages')
-    else:
-        return os.path.join(prefix, 'site-packages')
+    return os.path.join(prefix, 'site-packages')
 
 
 _config_vars = None

Modified: pypy/trunk/pypy/module/sys/state.py
==============================================================================
--- pypy/trunk/pypy/module/sys/state.py	(original)
+++ pypy/trunk/pypy/module/sys/state.py	Mon Jun 28 10:49:52 2010
@@ -32,30 +32,19 @@
     if not stat.S_ISDIR(st[0]):
         raise OSError(errno.ENOTDIR, path)
 
-def getinitialpath(prefix):
-    from pypy.module.sys.version import PYPY_VERSION
-    libdir = os.path.join(prefix, 'lib')
-    pypyxy_dir = os.path.join(libdir, 'pypy%d.%d' % PYPY_VERSION[:2])
-    # search for the stdlib both in $PREFIX/lib/pypy1.2 and $PREFIX
-    for lib_prefix in [pypyxy_dir, prefix]:
-        try:
-            return get_importlist(lib_prefix)
-        except OSError:
-            pass
-    raise OSError # stdlib not foud
 
-def get_importlist(lib_prefix):
+def getinitialpath(prefix):
     from pypy.module.sys.version import CPYTHON_VERSION
     dirname = '%d.%d.%d' % (CPYTHON_VERSION[0],
                             CPYTHON_VERSION[1],
                             CPYTHON_VERSION[2])
-    lib_python = os.path.join(lib_prefix, 'lib-python')
+    lib_python = os.path.join(prefix, 'lib-python')
     python_std_lib = os.path.join(lib_python, dirname)
     checkdir(python_std_lib)
     python_std_lib_modified = os.path.join(lib_python, 'modified-' + dirname)
     checkdir(python_std_lib_modified)
     
-    lib_pypy = os.path.join(lib_prefix, 'lib_pypy')
+    lib_pypy = os.path.join(prefix, 'lib_pypy')
     checkdir(lib_pypy)
 
     importlist = []

Modified: pypy/trunk/pypy/module/sys/test/test_initialpath.py
==============================================================================
--- pypy/trunk/pypy/module/sys/test/test_initialpath.py	(original)
+++ pypy/trunk/pypy/module/sys/test/test_initialpath.py	Mon Jun 28 10:49:52 2010
@@ -12,21 +12,7 @@
     return a, b, c
 
 
-def test_stdlib_in_pypyxy(tmpdir):
-    pypyxy = tmpdir.join('lib', 'pypy%d.%d' % PYPY_VERSION[:2])
-    dirs = build_hierarchy(pypyxy)
-    path = getinitialpath(str(tmpdir))
-    assert path == map(str, dirs)
-
-
 def test_stdlib_in_prefix(tmpdir):
     dirs = build_hierarchy(tmpdir)
     path = getinitialpath(str(tmpdir))
     assert path == map(str, dirs)
-
-def test_stdlib_precedence(tmpdir):
-    pypyxy = tmpdir.join('lib', 'pypy%d.%d' % PYPY_VERSION[:2])
-    dirs1 = build_hierarchy(tmpdir)
-    dirs2 = build_hierarchy(pypyxy)
-    path = getinitialpath(str(tmpdir))
-    assert path == map(str, dirs2)

Modified: pypy/trunk/pypy/translator/goal/test2/test_app_main.py
==============================================================================
--- pypy/trunk/pypy/translator/goal/test2/test_app_main.py	(original)
+++ pypy/trunk/pypy/translator/goal/test2/test_app_main.py	Mon Jun 28 10:49:52 2010
@@ -457,16 +457,14 @@
         # setup code for test_get_library_path
         # ------------------------------------
         from pypy.module.sys.version import CPYTHON_VERSION, PYPY_VERSION
-        libroot = 'lib/pypy%d.%d' % PYPY_VERSION[:2]
         cpy_ver = '%d.%d.%d' % CPYTHON_VERSION[:3]
         
         goal_dir = os.path.dirname(app_main)
         # build a directory hierarchy like which contains both bin/pypy-c and
         # lib/pypy1.2/*
-        prefix = udir.join('pathtest')
+        prefix = udir.join('pathtest').ensure(dir=1)
         fake_exe = prefix.join('bin/pypy-c').ensure(file=1)
-        pypyxy = prefix.join(libroot).ensure(dir=1)
-        expected_path = [str(pypyxy.join(subdir).ensure(dir=1))
+        expected_path = [str(prefix.join(subdir).ensure(dir=1))
                          for subdir in ('lib_pypy',
                                         'lib-python/modified-%s' % cpy_ver,
                                         'lib-python/%s' % cpy_ver)]



More information about the Pypy-commit mailing list