Description: Remove dependencies on the rest of PyPy's source
 Remove py.path dependancy from sandlib.
 Print warning if py.log isn't available and is needed (--verbose).
 Remove autopath, and don't require lib_python and lib-pypy to be in sys.path.
Author: Stefano Rivera <stefanor@debian.org>
Forwarded: no
Last-Update: 2012-02-14

--- a/pypy/translator/sandbox/sandlib.py
+++ b/pypy/translator/sandbox/sandlib.py
@@ -8,11 +8,16 @@
 import subprocess
 from pypy.tool.killsubprocess import killsubprocess
 from pypy.translator.sandbox.vfs import UID, GID
-import py
 
 def create_log():
     """Make and return a log for the sandbox to use, if needed."""
     # These imports are local to avoid importing pypy if we don't need to.
+    try:
+        import py
+    except ImportError:
+        sys.stderr.write("The --verbose option requires python-py to be installed.\n")
+        return None
+
     from pypy.tool.ansi_print import AnsiLog
 
     class MyAnsiLog(AnsiLog):
@@ -34,9 +39,8 @@
 # load().  Also, marshal.load(f) blocks with the GIL held when
 # f is a pipe with no data immediately avaialble, preventing the
 # _waiting_thread to run.
-import pypy
-marshal = py.path.local(pypy.__file__).join('..', '..', 'lib_pypy',
-                                            'marshal.py').pyimport()
+# In Debian we have a marshal symlinked into lib_pypy
+import marshal
 
 # Non-marshal result types
 RESULTTYPE_STATRESULT = object()
--- a/pypy/translator/sandbox/pypy_interact.py
+++ b/pypy/translator/sandbox/pypy_interact.py
@@ -23,12 +23,10 @@
 """
 
 import sys, os
-import autopath
 from pypy.translator.sandbox.sandlib import SimpleIOSandboxedProc
 from pypy.translator.sandbox.sandlib import VirtualizedSandboxedProc
 from pypy.translator.sandbox.vfs import Dir, RealDir, RealFile
-import pypy
-LIB_ROOT = os.path.dirname(os.path.dirname(pypy.__file__))
+LIB_ROOT = '/usr/lib/pypy'
 
 class PyPySandboxedProc(VirtualizedSandboxedProc, SimpleIOSandboxedProc):
     argv0 = '/bin/pypy-c'
