aboutsummaryrefslogtreecommitdiffstats
path: root/setuptools/sandbox.py
diff options
context:
space:
mode:
authorVinay Sajip <vinay_sajip@yahoo.co.uk>2013-06-15 15:34:53 +0100
committerVinay Sajip <vinay_sajip@yahoo.co.uk>2013-06-15 15:34:53 +0100
commit8e657eac1ef02faedca99df319fff6b63f4a4305 (patch)
treef3f2ed97342421c6b65c9caaab8ae5d830f04059 /setuptools/sandbox.py
parentc04abca662dcbffd00d928e06fbf32b9f49f8e57 (diff)
downloadexternal_python_setuptools-8e657eac1ef02faedca99df319fff6b63f4a4305.tar.gz
external_python_setuptools-8e657eac1ef02faedca99df319fff6b63f4a4305.tar.bz2
external_python_setuptools-8e657eac1ef02faedca99df319fff6b63f4a4305.zip
Initial commit. All tests pass on 2.7, 3.2 and 3.3, though there are some atexit errors in the multiprocessing module in 2.7/3.2 (seemingly unrelated to setuptools).
--HG-- branch : single-codebase
Diffstat (limited to 'setuptools/sandbox.py')
-rwxr-xr-xsetuptools/sandbox.py16
1 files changed, 9 insertions, 7 deletions
diff --git a/setuptools/sandbox.py b/setuptools/sandbox.py
index f3095125..090cb34c 100755
--- a/setuptools/sandbox.py
+++ b/setuptools/sandbox.py
@@ -1,4 +1,4 @@
-import os, sys, __builtin__, tempfile, operator, pkg_resources
+import os, sys, tempfile, operator, pkg_resources
if os.name == "java":
import org.python.modules.posix.PosixModule as _os
else:
@@ -9,6 +9,7 @@ except NameError:
_file = None
_open = open
from distutils.errors import DistutilsError
+from setuptools.compat import builtins, execfile, reduce
from pkg_resources import working_set
__all__ = [
@@ -69,7 +70,8 @@ def run_setup(setup_script, args):
{'__file__':setup_script, '__name__':'__main__'}
)
)
- except SystemExit, v:
+ except SystemExit:
+ v = sys.exc_info()[1]
if v.args and v.args[0]:
raise
# Normal exit, just return
@@ -111,15 +113,15 @@ class AbstractSandbox:
try:
self._copy(self)
if _file:
- __builtin__.file = self._file
- __builtin__.open = self._open
+ builtins.file = self._file
+ builtins.open = self._open
self._active = True
return func()
finally:
self._active = False
if _file:
- __builtin__.file = _file
- __builtin__.open = _open
+ builtins.file = _file
+ builtins.open = _open
self._copy(_os)
def _mk_dual_path_wrapper(name):
@@ -267,7 +269,7 @@ class DirectorySandbox(AbstractSandbox):
self._violation(operation, src, dst, *args, **kw)
return (src,dst)
- def open(self, file, flags, mode=0777):
+ def open(self, file, flags, mode=0x1FF): # 0777
"""Called for low-level os.open()"""
if flags & WRITE_FLAGS and not self._ok(file):
self._violation("os.open", file, flags, mode)