module documentation

Undocumented

Class AbstractSandbox Wrap 'os' module and 'open()' builtin for virtualizing setup scripts
Class DirectorySandbox Restrict operations to a single subdirectory - pseudo-chroot
Class ExceptionSaver A Context Manager that will save an exception, serialized, and restore it later.
Class SandboxViolation A setup script attempted to modify the filesystem outside the sandbox
Exception UnpickleableException An exception representing another Exception that could not be pickled.
Function hide_setuptools Remove references to setuptools' modules from sys.modules to allow the invocation to import the most appropriate setuptools. This technique is necessary to avoid issues such as #315 where setuptools upgrading itself would fail to find a function declared in the metadata.
Function override_temp Monkey-patch tempfile.tempdir with replacement, ensuring it exists
Function pushd Undocumented
Function run_setup Run a distutils setup script, sandboxed in its directory
Function save_argv Undocumented
Function save_modules Context in which imported modules are saved.
Function save_path Undocumented
Function save_pkg_resources_state Undocumented
Function setup_context Undocumented
Constant WRITE_FLAGS Undocumented
Function _clear_modules Undocumented
Function _execfile Python 3 implementation of execfile.
Function _needs_hiding >>> _needs_hiding('setuptools') True >>> _needs_hiding('pkg_resources') True >>> _needs_hiding('setuptools_plugin') False >>> _needs_hiding('setuptools.__init__') True >>> _needs_hiding('distutils') True >>> _needs_hiding('os') False >>> _needs_hiding('Cython') True...
Constant _EXCEPTIONS Undocumented
Constant _MODULES_TO_HIDE Undocumented
def hide_setuptools(): (source)

Remove references to setuptools' modules from sys.modules to allow the invocation to import the most appropriate setuptools. This technique is necessary to avoid issues such as #315 where setuptools upgrading itself would fail to find a function declared in the metadata.

@contextlib.contextmanager
def override_temp(replacement): (source)

Monkey-patch tempfile.tempdir with replacement, ensuring it exists

Undocumented

def run_setup(setup_script, args): (source)

Run a distutils setup script, sandboxed in its directory

Undocumented

Context in which imported modules are saved. Translates exceptions internal to the context into the equivalent exception outside the context.

Undocumented

@contextlib.contextmanager
def save_pkg_resources_state(): (source)

Undocumented

@contextlib.contextmanager
def setup_context(setup_dir): (source)

Undocumented

WRITE_FLAGS = (source)

Undocumented

Value
functools.reduce(operator.or_,
                 [getattr(_os, a, 0) for a in
    'O_WRONLY O_RDWR O_APPEND O_CREAT O_TRUNC O_TEMPORARY'.split()])
def _clear_modules(module_names): (source)

Undocumented

def _execfile(filename, globals, locals=None): (source)

Python 3 implementation of execfile.

def _needs_hiding(mod_name): (source)

>>> _needs_hiding('setuptools') True >>> _needs_hiding('pkg_resources') True >>> _needs_hiding('setuptools_plugin') False >>> _needs_hiding('setuptools.__init__') True >>> _needs_hiding('distutils') True >>> _needs_hiding('os') False >>> _needs_hiding('Cython') True

_EXCEPTIONS = (source)

Undocumented

Value
[os.devnull]
_MODULES_TO_HIDE: set[str] = (source)

Undocumented

Value
set(['setuptools', 'distutils', 'pkg_resources', 'Cython', '_distutils_hack'])