From 8e657eac1ef02faedca99df319fff6b63f4a4305 Mon Sep 17 00:00:00 2001 From: Vinay Sajip Date: Sat, 15 Jun 2013 15:34:53 +0100 Subject: 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 --- setuptools/sandbox.py | 16 +++++++++------- 1 file changed, 9 insertions(+), 7 deletions(-) (limited to 'setuptools/sandbox.py') 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) -- cgit v1.2.1 From 744a61f18bbfcbf7dfaa08886185b4595d8b7bcb Mon Sep 17 00:00:00 2001 From: Vinay Sajip Date: Mon, 17 Jun 2013 19:23:33 +0100 Subject: Misc. updates following 2to3 checks. --HG-- branch : single-codebase --- setuptools/sandbox.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'setuptools/sandbox.py') diff --git a/setuptools/sandbox.py b/setuptools/sandbox.py index 090cb34c..a5a01a46 100755 --- a/setuptools/sandbox.py +++ b/setuptools/sandbox.py @@ -85,7 +85,7 @@ def run_setup(setup_script, args): # exclude any encodings modules. See #285 and not mod_name.startswith('encodings.') ] - map(sys.modules.__delitem__, del_modules) + list(map(sys.modules.__delitem__, del_modules)) os.chdir(old_dir) sys.path[:] = save_path sys.argv[:] = save_argv -- cgit v1.2.1 From 7161829fd5e4515903ce56b711e551bc75c35ba7 Mon Sep 17 00:00:00 2001 From: Vinay Sajip Date: Wed, 19 Jun 2013 12:07:26 +0100 Subject: More post-merge fixes. --HG-- branch : single-codebase --- setuptools/sandbox.py | 1 - 1 file changed, 1 deletion(-) (limited to 'setuptools/sandbox.py') diff --git a/setuptools/sandbox.py b/setuptools/sandbox.py index 91dfc519..4e527446 100755 --- a/setuptools/sandbox.py +++ b/setuptools/sandbox.py @@ -9,7 +9,6 @@ except NameError: _file = None _open = open from distutils.errors import DistutilsError -from setuptools.compat import builtins, execfile, reduce from pkg_resources import working_set from setuptools.compat import builtins, execfile, reduce -- cgit v1.2.1