aboutsummaryrefslogtreecommitdiffstats
path: root/setuptools/sandbox.py
diff options
context:
space:
mode:
authorstepshal <nessento@openmailbox.org>2016-07-12 22:00:43 +0700
committerstepshal <nessento@openmailbox.org>2016-07-13 06:00:42 +0700
commit6d11e88f938f09ef16db4c6064b6e74acba4db1d (patch)
tree18b8d914a2c4fc9f9e00d75a5b30330bb0d1942a /setuptools/sandbox.py
parente3e21fd3d608d72ebe1ba2e4d2b3a59fbca76554 (diff)
downloadexternal_python_setuptools-6d11e88f938f09ef16db4c6064b6e74acba4db1d.tar.gz
external_python_setuptools-6d11e88f938f09ef16db4c6064b6e74acba4db1d.tar.bz2
external_python_setuptools-6d11e88f938f09ef16db4c6064b6e74acba4db1d.zip
Fix quantity of blank lines after code object.
Diffstat (limited to 'setuptools/sandbox.py')
-rwxr-xr-xsetuptools/sandbox.py34
1 files changed, 9 insertions, 25 deletions
diff --git a/setuptools/sandbox.py b/setuptools/sandbox.py
index 23e296b1..83c3afdb 100755
--- a/setuptools/sandbox.py
+++ b/setuptools/sandbox.py
@@ -29,6 +29,7 @@ __all__ = [
"AbstractSandbox", "DirectorySandbox", "SandboxViolation", "run_setup",
]
+
def _execfile(filename, globals, locals=None):
"""
Python 3 implementation of execfile.
@@ -117,6 +118,7 @@ class ExceptionSaver:
A Context Manager that will save an exception, serialized, and restore it
later.
"""
+
def __enter__(self):
return self
@@ -237,6 +239,7 @@ def run_setup(setup_script, args):
# reset to include setup dir, w/clean callback list
working_set.__init__()
working_set.callbacks.append(lambda dist:dist.activate())
+
def runner():
ns = dict(__file__=setup_script, __name__='__main__')
_execfile(setup_script, ns)
@@ -280,6 +283,7 @@ class AbstractSandbox:
def _mk_dual_path_wrapper(name):
original = getattr(_os,name)
+
def wrap(self,src,dst,*args,**kw):
if self._active:
src,dst = self._remap_pair(name,src,dst,*args,**kw)
@@ -291,6 +295,7 @@ class AbstractSandbox:
def _mk_single_path_wrapper(name, original=None):
original = original or getattr(_os,name)
+
def wrap(self,path,*args,**kw):
if self._active:
path = self._remap_input(name,path,*args,**kw)
@@ -309,6 +314,7 @@ class AbstractSandbox:
def _mk_single_with_return(name):
original = getattr(_os,name)
+
def wrap(self,path,*args,**kw):
if self._active:
path = self._remap_input(name,path,*args,**kw)
@@ -321,6 +327,7 @@ class AbstractSandbox:
def _mk_query(name):
original = getattr(_os,name)
+
def wrap(self,*args,**kw):
retval = original(*args,**kw)
if self._active:
@@ -364,6 +371,7 @@ except ImportError:
# it appears pywin32 is not installed, so no need to exclude.
pass
+
class DirectorySandbox(AbstractSandbox):
"""Restrict operations to a single subdirectory - pseudo-chroot"""
@@ -453,6 +461,7 @@ WRITE_FLAGS = functools.reduce(
"O_WRONLY O_RDWR O_APPEND O_CREAT O_TRUNC O_TEMPORARY".split()]
)
+
class SandboxViolation(DistutilsError):
"""A setup script attempted to modify the filesystem outside the sandbox"""
@@ -468,29 +477,4 @@ script by hand. Please inform the package's author and the EasyInstall
maintainers to find out if a fix or workaround is available.""" % self.args
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
#