[pypy-svn] r74850 - in pypy/branch/sys-prefix/lib: . pypy1.2 pypy1.2/lib_pypy pypy1.2/lib_pypy/app_test pypy1.2/lib_pypy/ctypes_config_cache pypy1.2/lib_pypy/test2

antocuni at codespeak.net antocuni at codespeak.net
Fri May 28 15:53:56 CEST 2010


Author: antocuni
Date: Fri May 28 15:53:54 2010
New Revision: 74850

Added:
   pypy/branch/sys-prefix/lib/
   pypy/branch/sys-prefix/lib/README
   pypy/branch/sys-prefix/lib/pypy1.2/
   pypy/branch/sys-prefix/lib/pypy1.2/lib_pypy/
      - copied from r74817, pypy/branch/sys-prefix/pypy/lib/
   pypy/branch/sys-prefix/lib/pypy1.2/lib_pypy/_sre.py
      - copied unchanged from r74837, pypy/branch/sys-prefix/pypy/lib/_sre.py
   pypy/branch/sys-prefix/lib/pypy1.2/lib_pypy/py   (contents, props changed)
Removed:
   pypy/branch/sys-prefix/lib/pypy1.2/lib_pypy/ctypes_config_cache/autopath.py
   pypy/branch/sys-prefix/lib/pypy1.2/lib_pypy/identity_dict.py
   pypy/branch/sys-prefix/lib/pypy1.2/lib_pypy/test2/test_identitydict.py
Modified:
   pypy/branch/sys-prefix/lib/pypy1.2/lib_pypy/__init__.py
   pypy/branch/sys-prefix/lib/pypy1.2/lib_pypy/app_test/inprogress_test_binascii_extra.py
   pypy/branch/sys-prefix/lib/pypy1.2/lib_pypy/app_test/test_binascii.py
   pypy/branch/sys-prefix/lib/pypy1.2/lib_pypy/app_test/test_coroutine.py
   pypy/branch/sys-prefix/lib/pypy1.2/lib_pypy/app_test/test_ctypes_support.py
   pypy/branch/sys-prefix/lib/pypy1.2/lib_pypy/app_test/test_datetime.py
   pypy/branch/sys-prefix/lib/pypy1.2/lib_pypy/app_test/test_dbm_extra.py
   pypy/branch/sys-prefix/lib/pypy1.2/lib_pypy/app_test/test_defaultdict.py
   pypy/branch/sys-prefix/lib/pypy1.2/lib_pypy/app_test/test_deque_extra.py
   pypy/branch/sys-prefix/lib/pypy1.2/lib_pypy/app_test/test_exception_extra.py
   pypy/branch/sys-prefix/lib/pypy1.2/lib_pypy/app_test/test_functools.py
   pypy/branch/sys-prefix/lib/pypy1.2/lib_pypy/app_test/test_hashlib.py
   pypy/branch/sys-prefix/lib/pypy1.2/lib_pypy/app_test/test_locale.py
   pypy/branch/sys-prefix/lib/pypy1.2/lib_pypy/app_test/test_marshal_extra.py
   pypy/branch/sys-prefix/lib/pypy1.2/lib_pypy/app_test/test_md5_extra.py
   pypy/branch/sys-prefix/lib/pypy1.2/lib_pypy/app_test/test_pyexpat.py
   pypy/branch/sys-prefix/lib/pypy1.2/lib_pypy/app_test/test_resource.py
   pypy/branch/sys-prefix/lib/pypy1.2/lib_pypy/app_test/test_runpy.py
   pypy/branch/sys-prefix/lib/pypy1.2/lib_pypy/app_test/test_sha_extra.py
   pypy/branch/sys-prefix/lib/pypy1.2/lib_pypy/app_test/test_stackless.py
   pypy/branch/sys-prefix/lib/pypy1.2/lib_pypy/app_test/test_stackless_pickling.py
   pypy/branch/sys-prefix/lib/pypy1.2/lib_pypy/app_test/test_struct_extra.py
   pypy/branch/sys-prefix/lib/pypy1.2/lib_pypy/app_test/test_structseq.py
   pypy/branch/sys-prefix/lib/pypy1.2/lib_pypy/app_test/test_syslog.py
   pypy/branch/sys-prefix/lib/pypy1.2/lib_pypy/ctypes_config_cache/hashlib.ctc.py
   pypy/branch/sys-prefix/lib/pypy1.2/lib_pypy/ctypes_config_cache/locale.ctc.py
   pypy/branch/sys-prefix/lib/pypy1.2/lib_pypy/ctypes_config_cache/pyexpat.ctc.py
   pypy/branch/sys-prefix/lib/pypy1.2/lib_pypy/ctypes_config_cache/rebuild.py
   pypy/branch/sys-prefix/lib/pypy1.2/lib_pypy/ctypes_config_cache/resource.ctc.py
   pypy/branch/sys-prefix/lib/pypy1.2/lib_pypy/ctypes_config_cache/syslog.ctc.py
Log:
move pypy/lib/ to lib/pypy1.2/lib_pypy (part 1 of many).
The final goal is to be able to use pypy-trunk as sys.prefix, so
pypy-trunk/lib plays the role of /usr/lib in a normal system-wide installation.

Since pypy.lib is no longer directly importable, all the tests in app_test now
rely on relative imports to import the modules they are testing.

There are still issues left; e.g., test_runpy fails, and the app-level tests
in test2 should be moved somewhere else, because they need pypy/conftest.py to
work



Added: pypy/branch/sys-prefix/lib/README
==============================================================================
--- (empty file)
+++ pypy/branch/sys-prefix/lib/README	Fri May 28 15:53:54 2010
@@ -0,0 +1,7 @@
+This directory plays the role of /usr/lib or /usr/local/lib in a normal
+installation hierarchy.  
+
+It is here so that we can freely use tools like virtualenv without any need to
+install pypy system-wide, but just by using the root directory of the svn
+checkout as sys.prefix: this way, the stdlib can always be found in 
+sys.prefix + '/lib/pypyX.Y'

Modified: pypy/branch/sys-prefix/lib/pypy1.2/lib_pypy/__init__.py
==============================================================================
--- pypy/branch/sys-prefix/pypy/lib/__init__.py	(original)
+++ pypy/branch/sys-prefix/lib/pypy1.2/lib_pypy/__init__.py	Fri May 28 15:53:54 2010
@@ -1,4 +1,7 @@
 # This __init__.py shows up in PyPy's app-level standard library.
-# Let's try to prevent that confusion...
-if __name__ != 'pypy.lib':
+# Let's try to prevent that confusion.
+# Without this check, you would be able to do 'import __init__' from a pypy
+# prompt
+
+if __name__ != 'lib_pypy':
     raise ImportError, '__init__'

Modified: pypy/branch/sys-prefix/lib/pypy1.2/lib_pypy/app_test/inprogress_test_binascii_extra.py
==============================================================================
--- pypy/branch/sys-prefix/pypy/lib/app_test/inprogress_test_binascii_extra.py	(original)
+++ pypy/branch/sys-prefix/lib/pypy1.2/lib_pypy/app_test/inprogress_test_binascii_extra.py	Fri May 28 15:53:54 2010
@@ -1,5 +1,5 @@
-
-from pypy.lib import binascii
+from __future__ import absolute_import
+from .. import binascii
 
 def test_uu():
     assert binascii.b2a_uu('1234567') == "',3(S-#4V-P  \n"

Modified: pypy/branch/sys-prefix/lib/pypy1.2/lib_pypy/app_test/test_binascii.py
==============================================================================
--- pypy/branch/sys-prefix/pypy/lib/app_test/test_binascii.py	(original)
+++ pypy/branch/sys-prefix/lib/pypy1.2/lib_pypy/app_test/test_binascii.py	Fri May 28 15:53:54 2010
@@ -1,4 +1,6 @@
-from pypy.lib import binascii
+from __future__ import absolute_import
+import py
+from .. import binascii
 
 # Create binary test data
 data = "The quick brown fox jumps over the lazy dog.\r\n"
@@ -21,10 +23,10 @@
         for prefix in prefixes:
             name = prefix + suffix
             assert callable(getattr(binascii, name))
-            raises(TypeError, getattr(binascii, name))
+            py.test.raises(TypeError, getattr(binascii, name))
     for name in ("hexlify", "unhexlify"):
         assert callable(getattr(binascii, name))
-        raises(TypeError, getattr(binascii, name))
+        py.test.raises(TypeError, getattr(binascii, name))
 
 def test_base64valid():
     # Test base64 with valid data
@@ -93,10 +95,10 @@
     assert binascii.a2b_uu("\x7f") == "\x00"*31
     assert binascii.a2b_uu("\x80") == "\x00"*32
     assert binascii.a2b_uu("\xff") == "\x00"*31
-    raises(binascii.Error, binascii.a2b_uu, "\xff\x00")
-    raises(binascii.Error, binascii.a2b_uu, "!!!!")
+    py.test.raises(binascii.Error, binascii.a2b_uu, "\xff\x00")
+    py.test.raises(binascii.Error, binascii.a2b_uu, "!!!!")
 
-    raises(binascii.Error, binascii.b2a_uu, 46*"!")
+    py.test.raises(binascii.Error, binascii.b2a_uu, 46*"!")
 
 def test_crc32():
     crc = binascii.crc32("Test the CRC-32 of")
@@ -106,7 +108,7 @@
     crc = binascii.crc32('frotz\n', 0)
     assert crc == -372923920
 
-    raises(TypeError, binascii.crc32)
+    py.test.raises(TypeError, binascii.crc32)
 
 def test_hex():
     # test hexlification
@@ -114,8 +116,8 @@
     t = binascii.b2a_hex(s)
     u = binascii.a2b_hex(t)
     assert s == u
-    raises(TypeError, binascii.a2b_hex, t[:-1])
-    raises(TypeError, binascii.a2b_hex, t[:-1] + 'q')
+    py.test.raises(TypeError, binascii.a2b_hex, t[:-1])
+    py.test.raises(TypeError, binascii.a2b_hex, t[:-1] + 'q')
 
     # Verify the treatment of Unicode strings
     assert binascii.hexlify(unicode('a', 'ascii')) == '61'
@@ -131,7 +133,7 @@
     assert binascii.a2b_qp("= ") == "= "
     assert binascii.a2b_qp("==") == "="
     assert binascii.a2b_qp("=AX") == "=AX"
-    raises(TypeError, binascii.b2a_qp, foo="bar")
+    py.test.raises(TypeError, binascii.b2a_qp, foo="bar")
     assert binascii.a2b_qp("=00\r\n=00") == "\x00\r\n\x00"
     assert binascii.b2a_qp("\xff\r\n\xff\n\xff") == "=FF\r\n=FF\r\n=FF"
     target = "0"*75+"=\r\n=FF\r\n=FF\r\n=FF"
@@ -155,7 +157,7 @@
 
 def test_wrong_padding():
     s = 'CSixpLDtKSC/7Liuvsax4iC6uLmwMcijIKHaILzSwd/H0SC8+LCjwLsgv7W/+Mj3IQ'
-    raises(binascii.Error, binascii.a2b_base64, s)
+    py.test.raises(binascii.Error, binascii.a2b_base64, s)
 
 def test_crap_after_padding():
     s = 'xxx=axxxx'
@@ -163,4 +165,4 @@
 
 def test_wrong_args():
     # this should grow as a way longer list
-    raises(TypeError, binascii.a2b_base64, 42)
+    py.test.raises(TypeError, binascii.a2b_base64, 42)

Modified: pypy/branch/sys-prefix/lib/pypy1.2/lib_pypy/app_test/test_coroutine.py
==============================================================================
--- pypy/branch/sys-prefix/pypy/lib/app_test/test_coroutine.py	(original)
+++ pypy/branch/sys-prefix/lib/pypy1.2/lib_pypy/app_test/test_coroutine.py	Fri May 28 15:53:54 2010
@@ -1,7 +1,8 @@
+from __future__ import absolute_import
 from py.test import skip, raises
 
 try:
-    from pypy.lib.stackless import coroutine
+    from ..stackless import coroutine
 except ImportError, e:
     skip('cannot import stackless: %s' % (e,))
 

Modified: pypy/branch/sys-prefix/lib/pypy1.2/lib_pypy/app_test/test_ctypes_support.py
==============================================================================
--- pypy/branch/sys-prefix/pypy/lib/app_test/test_ctypes_support.py	(original)
+++ pypy/branch/sys-prefix/lib/pypy1.2/lib_pypy/app_test/test_ctypes_support.py	Fri May 28 15:53:54 2010
@@ -1,10 +1,11 @@
+from __future__ import absolute_import
 
 import py
 from ctypes import *
 try:
     from ctypes_support import standard_c_lib, get_errno, set_errno
 except ImportError:    # on top of cpython
-    from pypy.lib.ctypes_support import standard_c_lib, get_errno, set_errno
+    from ..ctypes_support import standard_c_lib, get_errno, set_errno
 
 
 def test_stdlib_and_errno():

Modified: pypy/branch/sys-prefix/lib/pypy1.2/lib_pypy/app_test/test_datetime.py
==============================================================================
--- pypy/branch/sys-prefix/pypy/lib/app_test/test_datetime.py	(original)
+++ pypy/branch/sys-prefix/lib/pypy1.2/lib_pypy/app_test/test_datetime.py	Fri May 28 15:53:54 2010
@@ -1,5 +1,6 @@
+from __future__ import absolute_import
 
-from pypy.lib import datetime
+from .. import datetime
 
 def test_repr():
     print datetime

Modified: pypy/branch/sys-prefix/lib/pypy1.2/lib_pypy/app_test/test_dbm_extra.py
==============================================================================
--- pypy/branch/sys-prefix/pypy/lib/app_test/test_dbm_extra.py	(original)
+++ pypy/branch/sys-prefix/lib/pypy1.2/lib_pypy/app_test/test_dbm_extra.py	Fri May 28 15:53:54 2010
@@ -1,7 +1,8 @@
+from __future__ import absolute_import
 import py
 from pypy.tool.udir import udir
 try:
-    from pypy.lib import dbm
+    from .. import dbm
 except ImportError, e:
     py.test.skip(e)
 

Modified: pypy/branch/sys-prefix/lib/pypy1.2/lib_pypy/app_test/test_defaultdict.py
==============================================================================
--- pypy/branch/sys-prefix/pypy/lib/app_test/test_defaultdict.py	(original)
+++ pypy/branch/sys-prefix/lib/pypy1.2/lib_pypy/app_test/test_defaultdict.py	Fri May 28 15:53:54 2010
@@ -1,16 +1,16 @@
 # defaultdict Tests
 # from CPython2.5
-
+from __future__ import absolute_import
+import py
 import sys
 if sys.version_info < (2, 5):
-    import py
     # the app-level defaultdict relies on the interp-level dict
     # calling __missing__()
     py.test.skip("these tests only run on top of CPython 2.5")
 
 import copy
 
-from pypy.lib.collections import defaultdict
+from ..collections import defaultdict
 
 def foobar():
     return list
@@ -45,12 +45,12 @@
         assert 12 not in d2.keys()
         d2.default_factory = None
         assert d2.default_factory == None
-        raises(KeyError, d2.__getitem__, 15)
-        raises(TypeError, defaultdict, 1)
+        py.test.raises(KeyError, d2.__getitem__, 15)
+        py.test.raises(TypeError, defaultdict, 1)
 
     def test_missing(self):
         d1 = defaultdict()
-        raises(KeyError, d1.__missing__, 42)
+        py.test.raises(KeyError, d1.__missing__, 42)
         d1.default_factory = list
         assert d1.__missing__(42) == []
 

Modified: pypy/branch/sys-prefix/lib/pypy1.2/lib_pypy/app_test/test_deque_extra.py
==============================================================================
--- pypy/branch/sys-prefix/pypy/lib/app_test/test_deque_extra.py	(original)
+++ pypy/branch/sys-prefix/lib/pypy1.2/lib_pypy/app_test/test_deque_extra.py	Fri May 28 15:53:54 2010
@@ -1,11 +1,13 @@
 # Deque Tests
+from __future__ import absolute_import
+import py
 
 
 n = 10
 class Test_deque:
     def setup_method(self,method):
         
-        from pypy.lib.collections import deque
+        from ..collections import deque
         self.deque = deque
         self.d = deque(range(n))
         
@@ -20,22 +22,22 @@
             
     def test_deque_iter(self):
         it = iter(self.d)
-        raises(TypeError, len, it)
+        py.test.raises(TypeError, len, it)
         assert it.next() == 0
         self.d.pop()
-        raises(RuntimeError, it.next)
+        py.test.raises(RuntimeError, it.next)
 
     def test_deque_reversed(self):
         it = reversed(self.d)
-        raises(TypeError, len, it)
+        py.test.raises(TypeError, len, it)
         assert it.next() == n-1
         assert it.next() == n-2
         self.d.pop()
-        raises(RuntimeError, it.next)
+        py.test.raises(RuntimeError, it.next)
 
     def test_deque_remove(self):
         d = self.d
-        raises(ValueError, d.remove, "foobar")
+        py.test.raises(ValueError, d.remove, "foobar")
 
     def test_mutate_during_remove(self):
         # Handle evil mutator
@@ -50,5 +52,5 @@
         for match in (True, False):
             d = self.deque(['ab'])
             d.extend([MutateCmp(d, match), 'c'])
-            raises(IndexError, d.remove, 'c')
+            py.test.raises(IndexError, d.remove, 'c')
             assert len(d) == 0

Modified: pypy/branch/sys-prefix/lib/pypy1.2/lib_pypy/app_test/test_exception_extra.py
==============================================================================
--- pypy/branch/sys-prefix/pypy/lib/app_test/test_exception_extra.py	(original)
+++ pypy/branch/sys-prefix/lib/pypy1.2/lib_pypy/app_test/test_exception_extra.py	Fri May 28 15:53:54 2010
@@ -1,4 +1,3 @@
-
 def app_test_environmenterror_repr():
     import exceptions as ex 
     e = ex.EnvironmentError("hello")

Modified: pypy/branch/sys-prefix/lib/pypy1.2/lib_pypy/app_test/test_functools.py
==============================================================================
--- pypy/branch/sys-prefix/pypy/lib/app_test/test_functools.py	(original)
+++ pypy/branch/sys-prefix/lib/pypy1.2/lib_pypy/app_test/test_functools.py	Fri May 28 15:53:54 2010
@@ -1,4 +1,5 @@
-from pypy.lib import functools
+from __future__ import absolute_import
+from .. import functools
 import unittest
 from test import test_support
 from weakref import proxy

Modified: pypy/branch/sys-prefix/lib/pypy1.2/lib_pypy/app_test/test_hashlib.py
==============================================================================
--- pypy/branch/sys-prefix/pypy/lib/app_test/test_hashlib.py	(original)
+++ pypy/branch/sys-prefix/lib/pypy1.2/lib_pypy/app_test/test_hashlib.py	Fri May 28 15:53:54 2010
@@ -1,7 +1,8 @@
-from pypy.lib.ctypes_config_cache import rebuild
+from __future__ import absolute_import
+from ..ctypes_config_cache import rebuild
 rebuild.rebuild_one('hashlib.ctc.py')
 
-from pypy.lib import hashlib, _hashlib
+from .. import hashlib, _hashlib
 
 def test_unicode():
     assert isinstance(hashlib.new('sha1', u'xxx'), _hashlib.hash)

Modified: pypy/branch/sys-prefix/lib/pypy1.2/lib_pypy/app_test/test_locale.py
==============================================================================
--- pypy/branch/sys-prefix/pypy/lib/app_test/test_locale.py	(original)
+++ pypy/branch/sys-prefix/lib/pypy1.2/lib_pypy/app_test/test_locale.py	Fri May 28 15:53:54 2010
@@ -1,10 +1,11 @@
+from __future__ import absolute_import
 import py
 import sys
 
-from pypy.lib.ctypes_config_cache import rebuild
+from ..ctypes_config_cache import rebuild
 rebuild.rebuild_one('locale.ctc.py')
 
-from pypy.lib import _locale
+from .. import _locale
 
 
 def setup_module(mod):

Modified: pypy/branch/sys-prefix/lib/pypy1.2/lib_pypy/app_test/test_marshal_extra.py
==============================================================================
--- pypy/branch/sys-prefix/pypy/lib/app_test/test_marshal_extra.py	(original)
+++ pypy/branch/sys-prefix/lib/pypy1.2/lib_pypy/app_test/test_marshal_extra.py	Fri May 28 15:53:54 2010
@@ -1,7 +1,8 @@
+from __future__ import absolute_import
 import py
 import sys
 import marshal as cpy_marshal
-from pypy.lib import _marshal as marshal
+from .. import _marshal as marshal
 
 from pypy.tool.udir import udir 
 

Modified: pypy/branch/sys-prefix/lib/pypy1.2/lib_pypy/app_test/test_md5_extra.py
==============================================================================
--- pypy/branch/sys-prefix/pypy/lib/app_test/test_md5_extra.py	(original)
+++ pypy/branch/sys-prefix/lib/pypy1.2/lib_pypy/app_test/test_md5_extra.py	Fri May 28 15:53:54 2010
@@ -4,8 +4,9 @@
 160 sec. per MB of data on a 233 MHz Intel Pentium CPU.
 """
 
+from __future__ import absolute_import
 import md5                              # CPython's implementation in C.
-from pypy.lib import md5 as pymd5  
+from .. import md5 as pymd5  
 
 
 # Helpers...

Modified: pypy/branch/sys-prefix/lib/pypy1.2/lib_pypy/app_test/test_pyexpat.py
==============================================================================
--- pypy/branch/sys-prefix/pypy/lib/app_test/test_pyexpat.py	(original)
+++ pypy/branch/sys-prefix/lib/pypy1.2/lib_pypy/app_test/test_pyexpat.py	Fri May 28 15:53:54 2010
@@ -1,13 +1,14 @@
 # XXX TypeErrors on calling handlers, or on bad return values from a
 # handler, are obscure and unhelpful.
 
+from __future__ import absolute_import
 import StringIO, sys
 import unittest, py
 
-from pypy.lib.ctypes_config_cache import rebuild
+from ..ctypes_config_cache import rebuild
 rebuild.rebuild_one('pyexpat.ctc.py')
 
-from pypy.lib import pyexpat
+from .. import pyexpat
 #from xml.parsers import expat
 expat = pyexpat
 
@@ -520,7 +521,7 @@
         parser = expat.ParserCreate()
         parser.CharacterDataHandler = handler
 
-        raises(Exception, parser.Parse, xml)
+        py.test.raises(Exception, parser.Parse, xml)
 
 class TestChardataBuffer:
     """
@@ -539,9 +540,9 @@
         def f(size):
             parser.buffer_size = size
 
-        raises(TypeError, f, sys.maxint+1)
-        raises(ValueError, f, -1)
-        raises(ValueError, f, 0)
+        py.test.raises(TypeError, f, sys.maxint+1)
+        py.test.raises(ValueError, f, -1)
+        py.test.raises(ValueError, f, 0)
 
     def test_unchanged_size(self):
         xml1 = ("<?xml version='1.0' encoding='iso8859'?><s>%s" % ('a' * 512))

Modified: pypy/branch/sys-prefix/lib/pypy1.2/lib_pypy/app_test/test_resource.py
==============================================================================
--- pypy/branch/sys-prefix/pypy/lib/app_test/test_resource.py	(original)
+++ pypy/branch/sys-prefix/lib/pypy1.2/lib_pypy/app_test/test_resource.py	Fri May 28 15:53:54 2010
@@ -1,7 +1,8 @@
-from pypy.lib.ctypes_config_cache import rebuild
+from __future__ import absolute_import
+from ..ctypes_config_cache import rebuild
 rebuild.rebuild_one('resource.ctc.py')
 
-from pypy.lib import resource
+from .. import resource
 
 def test_resource():
     x = resource.getrusage(resource.RUSAGE_SELF)

Modified: pypy/branch/sys-prefix/lib/pypy1.2/lib_pypy/app_test/test_runpy.py
==============================================================================
--- pypy/branch/sys-prefix/pypy/lib/app_test/test_runpy.py	(original)
+++ pypy/branch/sys-prefix/lib/pypy1.2/lib_pypy/app_test/test_runpy.py	Fri May 28 15:53:54 2010
@@ -1,10 +1,11 @@
 # Test the runpy module
+from __future__ import absolute_import
 import unittest
 import os
 import os.path
 import sys
 import tempfile
-from pypy.lib.runpy import _run_module_code, run_module
+from ..runpy import _run_module_code, run_module
 
 
 verbose = 0

Modified: pypy/branch/sys-prefix/lib/pypy1.2/lib_pypy/app_test/test_sha_extra.py
==============================================================================
--- pypy/branch/sys-prefix/pypy/lib/app_test/test_sha_extra.py	(original)
+++ pypy/branch/sys-prefix/lib/pypy1.2/lib_pypy/app_test/test_sha_extra.py	Fri May 28 15:53:54 2010
@@ -3,8 +3,8 @@
 # use the three examples from Federal Information Processing Standards
 # Publication 180-1, Secure Hash Standard,  1995 April 17
 # http://www.itl.nist.gov/div897/pubs/fip180-1.htm
-
-from pypy.lib import sha 
+from __future__ import absolute_import
+from .. import sha 
 
 class TestSHA: 
     def check(self, data, digest):

Modified: pypy/branch/sys-prefix/lib/pypy1.2/lib_pypy/app_test/test_stackless.py
==============================================================================
--- pypy/branch/sys-prefix/pypy/lib/app_test/test_stackless.py	(original)
+++ pypy/branch/sys-prefix/lib/pypy1.2/lib_pypy/app_test/test_stackless.py	Fri May 28 15:53:54 2010
@@ -4,12 +4,13 @@
 2. CPython (with the stackless_new module in the path
 3. pypy-c
 """
+from __future__ import absolute_import
 from py.test import skip
 try:
     import stackless
 except ImportError:
     try:
-        from pypy.lib import stackless
+        from .. import stackless
     except ImportError, e:
         skip('cannot import stackless: %s' % (e,))
 

Modified: pypy/branch/sys-prefix/lib/pypy1.2/lib_pypy/app_test/test_stackless_pickling.py
==============================================================================
--- pypy/branch/sys-prefix/pypy/lib/app_test/test_stackless_pickling.py	(original)
+++ pypy/branch/sys-prefix/lib/pypy1.2/lib_pypy/app_test/test_stackless_pickling.py	Fri May 28 15:53:54 2010
@@ -2,12 +2,13 @@
 this test should probably not run from CPython or py.py.
 I'm not entirely sure, how to do that.
 """
+from __future__ import absolute_import
 from py.test import skip
 try:
     import stackless
 except ImportError:
     try:
-        from pypy.lib import stackless as stackless
+        from .. import stackless as stackless
     except ImportError, e:
         skip('cannot import stackless: %s' % (e,))
 

Modified: pypy/branch/sys-prefix/lib/pypy1.2/lib_pypy/app_test/test_struct_extra.py
==============================================================================
--- pypy/branch/sys-prefix/pypy/lib/app_test/test_struct_extra.py	(original)
+++ pypy/branch/sys-prefix/lib/pypy1.2/lib_pypy/app_test/test_struct_extra.py	Fri May 28 15:53:54 2010
@@ -1,4 +1,5 @@
-from pypy.lib import struct 
+from __future__ import absolute_import
+from .. import struct 
 
 def test_simple():
     morezeros = '\x00' * (struct.calcsize('l')-4)

Modified: pypy/branch/sys-prefix/lib/pypy1.2/lib_pypy/app_test/test_structseq.py
==============================================================================
--- pypy/branch/sys-prefix/pypy/lib/app_test/test_structseq.py	(original)
+++ pypy/branch/sys-prefix/lib/pypy1.2/lib_pypy/app_test/test_structseq.py	Fri May 28 15:53:54 2010
@@ -1,5 +1,6 @@
+from __future__ import absolute_import
 import py
-from pypy.lib._structseq import *
+from .._structseq import *
 
 
 class mydata:

Modified: pypy/branch/sys-prefix/lib/pypy1.2/lib_pypy/app_test/test_syslog.py
==============================================================================
--- pypy/branch/sys-prefix/pypy/lib/app_test/test_syslog.py	(original)
+++ pypy/branch/sys-prefix/lib/pypy1.2/lib_pypy/app_test/test_syslog.py	Fri May 28 15:53:54 2010
@@ -1,10 +1,10 @@
-
+from __future__ import absolute_import
 # XXX very minimal test
 
-from pypy.lib.ctypes_config_cache import rebuild
+from ..ctypes_config_cache import rebuild
 rebuild.rebuild_one('syslog.ctc.py')
 
-from pypy.lib import syslog
+from .. import syslog
 
 
 def test_syslog():

Modified: pypy/branch/sys-prefix/lib/pypy1.2/lib_pypy/ctypes_config_cache/hashlib.ctc.py
==============================================================================
--- pypy/branch/sys-prefix/pypy/lib/ctypes_config_cache/hashlib.ctc.py	(original)
+++ pypy/branch/sys-prefix/lib/pypy1.2/lib_pypy/ctypes_config_cache/hashlib.ctc.py	Fri May 28 15:53:54 2010
@@ -3,7 +3,6 @@
 Run this to rebuild _hashlib_cache.py.
 """
 
-import autopath
 from ctypes import *
 from ctypes_configure import configure, dumpcache
 

Modified: pypy/branch/sys-prefix/lib/pypy1.2/lib_pypy/ctypes_config_cache/locale.ctc.py
==============================================================================
--- pypy/branch/sys-prefix/pypy/lib/ctypes_config_cache/locale.ctc.py	(original)
+++ pypy/branch/sys-prefix/lib/pypy1.2/lib_pypy/ctypes_config_cache/locale.ctc.py	Fri May 28 15:53:54 2010
@@ -3,7 +3,6 @@
 Run this to rebuild _locale_cache.py.
 """
 
-import autopath
 from ctypes_configure.configure import (configure, ExternalCompilationInfo,
     ConstantInteger, DefinedConstantInteger, SimpleType, check_eci)
 from ctypes_configure.dumpcache import dumpcache

Modified: pypy/branch/sys-prefix/lib/pypy1.2/lib_pypy/ctypes_config_cache/pyexpat.ctc.py
==============================================================================
--- pypy/branch/sys-prefix/pypy/lib/ctypes_config_cache/pyexpat.ctc.py	(original)
+++ pypy/branch/sys-prefix/lib/pypy1.2/lib_pypy/ctypes_config_cache/pyexpat.ctc.py	Fri May 28 15:53:54 2010
@@ -3,7 +3,6 @@
 Run this to rebuild _pyexpat_cache.py.
 """
 
-import autopath
 import ctypes
 from ctypes import c_char_p, c_int, c_void_p, c_char
 from ctypes_configure import configure, dumpcache

Modified: pypy/branch/sys-prefix/lib/pypy1.2/lib_pypy/ctypes_config_cache/rebuild.py
==============================================================================
--- pypy/branch/sys-prefix/pypy/lib/ctypes_config_cache/rebuild.py	(original)
+++ pypy/branch/sys-prefix/lib/pypy1.2/lib_pypy/ctypes_config_cache/rebuild.py	Fri May 28 15:53:54 2010
@@ -1,7 +1,12 @@
 #! /usr/bin/env python
 # Run this script to rebuild all caches from the *.ctc.py files.
 
-import autopath
+# hack: we cannot directly import autopath, as we are outside the pypy
+# package.  However, we pretend to be inside pypy/tool and manually run it, to
+# get the correct path
+autopath_py = '../../../../pypy/tool/autopath.py'
+execfile(autopath_py, dict(__name__='autopath', __file__=autopath_py))
+
 import os, sys
 import py
 

Modified: pypy/branch/sys-prefix/lib/pypy1.2/lib_pypy/ctypes_config_cache/resource.ctc.py
==============================================================================
--- pypy/branch/sys-prefix/pypy/lib/ctypes_config_cache/resource.ctc.py	(original)
+++ pypy/branch/sys-prefix/lib/pypy1.2/lib_pypy/ctypes_config_cache/resource.ctc.py	Fri May 28 15:53:54 2010
@@ -3,8 +3,6 @@
 Run this to rebuild _resource_cache.py.
 """
 
-import autopath
-
 from ctypes import sizeof
 from ctypes_configure.dumpcache import dumpcache
 from ctypes_configure.configure import (configure,

Modified: pypy/branch/sys-prefix/lib/pypy1.2/lib_pypy/ctypes_config_cache/syslog.ctc.py
==============================================================================
--- pypy/branch/sys-prefix/pypy/lib/ctypes_config_cache/syslog.ctc.py	(original)
+++ pypy/branch/sys-prefix/lib/pypy1.2/lib_pypy/ctypes_config_cache/syslog.ctc.py	Fri May 28 15:53:54 2010
@@ -3,7 +3,6 @@
 Run this to rebuild _syslog_cache.py.
 """
 
-import autopath
 from ctypes_configure.configure import (configure,
     ExternalCompilationInfo, ConstantInteger, DefinedConstantInteger)
 from ctypes_configure.dumpcache import dumpcache

Added: pypy/branch/sys-prefix/lib/pypy1.2/lib_pypy/py
==============================================================================
--- (empty file)
+++ pypy/branch/sys-prefix/lib/pypy1.2/lib_pypy/py	Fri May 28 15:53:54 2010
@@ -0,0 +1 @@
+link ../../../py
\ No newline at end of file



More information about the Pypy-commit mailing list