rezplugins.shell.cmd
Windows Command Prompt (DOS) shell.
- class rezplugins.shell.cmd.CMD[source]
Bases:
rez.shells.Shell- escape_string(value, is_path=False)[source]
Escape the <, >, ^, and & special characters reserved by Windows.
- Parameters
value (str/EscapedString) – String or already escaped string.
- Returns
The value escaped for Windows.
- Return type
- expand_env_vars = True
- classmethod file_extension()[source]
Get the file extension associated with the shell.
- Returns
Shell file extension.
- Return type
- classmethod get_all_key_tokens(key)[source]
Encodes the environment variable into the shell specific forms. Shells might implement multiple forms, but the most common/safest should be always returned at index 0.
- Parameters
key – Variable name to encode
- Returns
list of str with encoded token forms
- get_output(style=<OutputStyle.file: ('Code as it would appear in a script file.', )>)[source]
Returns any implementation specific data.
- Parameters
style (OutputStyle) – Style affecting output format.
- Returns
Depends on implementation, but usually a code string.
- classmethod join(command)[source]
Note: Default to unix sh/bash- friendly behaviour.
- Parameters
command – A sequence of program arguments to be joined into a single string that can be executed in the current shell.
- Returns
A string object representing the command.
- normalize_path(path)[source]
Normalize a path.
Change path to a valid filepath representation for this interpreter.
IMPORTANT: Because var references like ${THIS} might be passed to funcs like appendvar, path might be in this form. You need to take that into account (ie, ensure normalization doesn’t break such a var reference).
- Parameters
path (str) – A filepath which may be in posix format, or windows format, or some combination of the two. For eg, a string like {root}/bin on windows will evaluate to C:.../bin - in this case, the cmd shell would want to normalize this and convert to all forward slashes.
- Returns
The normalized path.
- Return type
- spawn_shell(context_file, tmpdir, rcfile=None, norc=False, stdin=False, command=None, env=None, quiet=False, pre_command=None, add_rez=True, **Popen_args)[source]
Spawn a possibly interactive subshell. :param context: _file File that must be sourced in the new shell, this
configures the Rez environment.
- Parameters
tmpdir – Tempfiles, if needed, should be created within this path.
rcfile – Custom startup script.
norc – Don’t run startup scripts. Overrides rcfile.
stdin – If True, read commands from stdin in a non-interactive shell. If a different non-False value, such as subprocess.PIPE, the same occurs, but stdin is also passed to the resulting subprocess.Popen object.
command – If not None, execute this command in a non-interactive shell. If an empty string, don’t run a command, but don’t open an interactive shell either.
env – Environ dict to execute the shell within; uses the current environment if None.
quiet – If True, don’t show the configuration summary, and suppress any stdout from startup scripts.
pre_command – Command to inject before the shell command itself. This is for internal use.
add_rez – If True, assume this shell is being used with rez, and do things such as set the prompt etc.
package_commands_sourced_first – If True, source the context file before sourcing startup scripts (such as .bashrc). If False, source the context file AFTER. If None, use the configured setting.
popen_args – args to pass to the shell process object constructor.
- Returns
A subprocess.Popen object representing the shell process.
- classmethod startup_capabilities(rcfile=False, norc=False, stdin=False, command=False)[source]
Given a set of options related to shell startup, return the actual options that will be applied. @returns 4-tuple representing applied value of each option.
- syspaths = None