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).
Author: Stefano Rivera <stefanor@debian.org>
Forwarded: no
Last-Update: 2013-02-23

--- a/rpython/translator/sandbox/sandlib.py
+++ b/rpython/translator/sandbox/sandlib.py
@@ -8,11 +8,16 @@
 import subprocess
 from rpython.tool.killsubprocess import killsubprocess
 from rpython.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 rpython.tool.ansi_print import AnsiLog
 
     class MyAnsiLog(AnsiLog):
@@ -34,7 +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.
-from rpython.translator.sandbox import _marshal as marshal
+# In Debian we have a marshal symlinked into lib_pypy
+import marshal
 
 # Non-marshal result types
 RESULTTYPE_STATRESULT = object()
--- a/pypy/sandbox/pypy_interact.py
+++ b/pypy/sandbox/pypy_interact.py
@@ -25,8 +25,7 @@
 from rpython.translator.sandbox.sandlib import SimpleIOSandboxedProc
 from rpython.translator.sandbox.sandlib import VirtualizedSandboxedProc
 from rpython.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'
