aboutsummaryrefslogtreecommitdiffstats
path: root/setuptools/sandbox.py
diff options
context:
space:
mode:
authorHanno Schlichting <hanno@hannosch.eu>2009-07-16 17:39:16 +0200
committerHanno Schlichting <hanno@hannosch.eu>2009-07-16 17:39:16 +0200
commit457f95783acaed3c59668b6c6bf93414c4f1967b (patch)
tree33adb0a2a548d2db1fe8506edcfeca52399c3664 /setuptools/sandbox.py
parent334f5b69c08cc7b3f60f963a689987412db2e635 (diff)
downloadexternal_python_setuptools-457f95783acaed3c59668b6c6bf93414c4f1967b.tar.gz
external_python_setuptools-457f95783acaed3c59668b6c6bf93414c4f1967b.tar.bz2
external_python_setuptools-457f95783acaed3c59668b6c6bf93414c4f1967b.zip
Applied patch from pjenvey. This closes #6.
--HG-- branch : distribute extra : rebase_source : 96ce51b3a70155a8b87de8ed0f72de8e12a7a27c
Diffstat (limited to 'setuptools/sandbox.py')
-rwxr-xr-xsetuptools/sandbox.py10
1 files changed, 7 insertions, 3 deletions
diff --git a/setuptools/sandbox.py b/setuptools/sandbox.py
index 4db0dbdb..97865dd9 100755
--- a/setuptools/sandbox.py
+++ b/setuptools/sandbox.py
@@ -1,5 +1,6 @@
import os, sys, __builtin__, tempfile, operator
_os = sys.modules[os.name]
+_file = file
_open = open
from distutils.errors import DistutilsError
__all__ = [
@@ -58,12 +59,14 @@ class AbstractSandbox:
"""Run 'func' under os sandboxing"""
try:
self._copy(self)
- __builtin__.open = __builtin__.file = self._open
+ __builtin__.file = self._file
+ __builtin__.open = self._open
self._active = True
return func()
finally:
self._active = False
- __builtin__.open = __builtin__.file = _open
+ __builtin__.file = _file
+ __builtin__.open = _open
self._copy(_os)
@@ -88,7 +91,8 @@ class AbstractSandbox:
return original(path,*args,**kw)
return wrap
- _open = _mk_single_path_wrapper('file', _open)
+ _file = _mk_single_path_wrapper('file', _file)
+ _open = _mk_single_path_wrapper('open', _open)
for name in [
"stat", "listdir", "chdir", "open", "chmod", "chown", "mkdir",
"remove", "unlink", "rmdir", "utime", "lchown", "chroot", "lstat",