rez.utils.execution
Utilities related to process/script execution.
- class rez.utils.execution.ExecutableScriptMode(value, names=None, module=None, type=None)[source]
Bases:
rez.vendor.enum.EnumWhich scripts to create with util.create_executable_script.
- class rez.utils.execution.Popen(args, **kwargs)[source]
Bases:
subprocess.Popensubprocess.Popen wrapper.
Allows for Popen to be used as a context in both py2 and py3.
- rez.utils.execution.create_executable_script(filepath, body, program=None, py_script_mode=None)[source]
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)[source]
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.