rez.utils.execution#
Utilities related to process/script execution.
- rez.utils.execution.add_sys_paths(paths)#
Add to sys.path, and revert on scope exit.
- class rez.utils.execution.Popen#
subprocess.Popen wrapper.
Allows for Popen to be used as a context in both py2 and py3.
- __init__(args, **kwargs)#
Create new Popen instance.
- class rez.utils.execution.ExecutableScriptMode#
Which scripts to create with util.create_executable_script.
- rez.utils.execution.create_executable_script(filepath, body, program=None, py_script_mode=None)#
Create an executable script. In case a py_script_mode has been set to create a .py script the shell is expected to have the PATHEXT environment variable to include “.PY” in order to properly launch the command without the .py extension.
- Parameters:
filepath (str) – File to create.
body (str or callable) – Contents of the script. If a callable, its code is used as the script body.
program (str) – Name of program to launch the script. Default is ‘python’
py_script_mode (ExecutableScriptMode) – What kind of script to create. Defaults to rezconfig.create_executable_script_mode.
- Returns:
List of filepaths of created scripts. This may differ from the supplied filepath depending on the py_script_mode
- rez.utils.execution.create_forwarding_script(filepath, module, func_name, *nargs, **kwargs)#
Create a ‘forwarding’ script.
A forwarding script is one that executes some arbitrary Rez function. This is used internally by Rez to dynamically create a script that uses Rez, even though the parent environment may not be configured to do so.