diff options
author | Jason R. Coombs <jaraco@jaraco.com> | 2013-11-24 16:48:27 -0500 |
---|---|---|
committer | Jason R. Coombs <jaraco@jaraco.com> | 2013-11-24 16:48:27 -0500 |
commit | ecb026c64b97e1675ab830c4474331a6e03361a8 (patch) | |
tree | 8b5689ee7257e4e1bd51064c2ef12cfd88ed4b91 /setuptools/sandbox.py | |
parent | 715085069e4882ee67d6898f12b975c05dd6b769 (diff) | |
download | external_python_setuptools-ecb026c64b97e1675ab830c4474331a6e03361a8.tar.gz external_python_setuptools-ecb026c64b97e1675ab830c4474331a6e03361a8.tar.bz2 external_python_setuptools-ecb026c64b97e1675ab830c4474331a6e03361a8.zip |
Modernize style on sandbox.py
Diffstat (limited to 'setuptools/sandbox.py')
-rwxr-xr-x | setuptools/sandbox.py | 40 |
1 files changed, 8 insertions, 32 deletions
diff --git a/setuptools/sandbox.py b/setuptools/sandbox.py index 27914f2e..6dd1ca07 100755 --- a/setuptools/sandbox.py +++ b/setuptools/sandbox.py @@ -1,5 +1,11 @@ -import os, sys, tempfile, operator, pkg_resources +import os +import sys +import tempfile +import operator import functools + +import pkg_resources + if os.name == "java": import org.python.modules.posix.PosixModule as _os else: @@ -18,34 +24,6 @@ __all__ = [ "AbstractSandbox", "DirectorySandbox", "SandboxViolation", "run_setup", ] - - - - - - - - - - - - - - - - - - - - - - - - - - - - def run_setup(setup_script, args): """Run a distutils setup script, sandboxed in its directory""" old_dir = os.getcwd() @@ -94,7 +72,6 @@ def run_setup(setup_script, args): tempfile.tempdir = save_tmp - class AbstractSandbox: """Wrap 'os' module and 'open()' builtin for virtualizing setup scripts""" @@ -137,7 +114,6 @@ class AbstractSandbox: for name in ["rename", "link", "symlink"]: if hasattr(_os,name): locals()[name] = _mk_dual_path_wrapper(name) - def _mk_single_path_wrapper(name, original=None): original = original or getattr(_os,name) def wrap(self,path,*args,**kw): @@ -250,7 +226,7 @@ class DirectorySandbox(AbstractSandbox): self._active = False realpath = os.path.normcase(os.path.realpath(path)) if (self._exempted(realpath) or realpath == self._sandbox - or realpath.startswith(self._prefix)): + or realpath.startswith(self._prefix)): return True finally: self._active = active |