sphinx_polyversion.environment
Build Environment Base API.
Classes
|
A build environment and contextmanager to run commands in. |
- class sphinx_polyversion.environment.Environment(path: Path, name: str)[source]
Bases:
object
A build environment and contextmanager to run commands in.
This is a base class but it can be instanciated as well to have a environment that does nothing.
- Parameters:
path (Path) – The location of the current revision.
name (str) – The name of the environment (usually the name of the current revision).
- run(*cmd: str, decode: bool = True, \*\*kwargs: Any)
Run a OS process in the environment.
- async __aenter__() ENV
Set the environment up.
- async __aexit__(*exc_info) bool | None
Clean the environment up.
- classmethod factory(**kwargs: Any) Callable[[Path, str], ENV]
Create a factory function for this environment class.
This returns a factory that can be used with
DefaultDriver
. This method works similiar tofunctools.partial()
. The arguments passed to this function will be used by the factory to instantiate the actual environment class.- Parameters:
**kwargs – Arguments to use when creating the instance.
- Returns:
The factory function.
- Return type:
Callable[[Path, str], ENV]
- async run(*cmd: str, decode: bool = True, **kwargs: Any) Tuple[str | bytes | None, str | bytes | None, int]
Run a OS process in the environment.
This implementation passes the arguments to
asyncio.create_subprocess_exec()
.- Returns:
stdout (str | None) – The output of the command,
stderr (str | None) – The error output of the command
returncode (int | None) – The returncode of the command