launch.actions.append_environment_variable module

Module for the AppendEnvironmentVariable action.

class launch.actions.append_environment_variable.AppendEnvironmentVariable[source]

Bases: Action

Action that appends to an environment variable if it exists and sets it if it does not.

It can optionally prepend instead of appending. It can also optionally use a custom separator, with the default being a platform-specific separator, os.pathsep.

__init__(name: str | Path | Substitution | Iterable[str | Path | Substitution], value: str | Path | Substitution | Iterable[str | Path | Substitution], prepend: bool | str | Path | Substitution | Iterable[str | Path | Substitution] = False, separator: str | Path | Substitution | Iterable[str | Path | Substitution] = ':', **kwargs) None[source]

Create an AppendEnvironmentVariable action.

All parameters can be provided as substitutions. A substitution for the prepend parameter will be coerced to bool following YAML rules.

Parameters:
  • name – the name of the environment variable

  • value – the value to set or append

  • prepend – whether the value should be prepended instead

  • separator – the separator to use, defaulting to a platform-specific separator

execute(context: LaunchContext) None[source]

Execute the action.

property name: List[Substitution]

Getter for the name of the environment variable to be set or appended to.

classmethod parse(entity: Entity, parser: Parser)[source]

Parse an ‘append_env’ entity.

property prepend: List[Substitution] | int | float | bool | str | List[int | List[Substitution]] | List[float | List[Substitution]] | List[bool | List[Substitution]] | List[str | List[Substitution]]

Getter for the prepend flag.

property separator: List[Substitution]

Getter for the separator.

property value: List[Substitution]

Getter for the value of the environment variable to be set or appended.