| Index: recipe_engine/recipe_api.py
|
| diff --git a/recipe_engine/recipe_api.py b/recipe_engine/recipe_api.py
|
| index 6ec91c3137bcfc74aa533b73cbc9083ce8df6773..b2e231f342cd42cf78d79841ff310e23783904cf 100644
|
| --- a/recipe_engine/recipe_api.py
|
| +++ b/recipe_engine/recipe_api.py
|
| @@ -257,9 +257,9 @@ class TriggerSpec(_TriggerSpec):
|
|
|
|
|
| _StepConfig = collections.namedtuple('_StepConfig',
|
| - ('name', 'base_name', 'cmd', 'cwd', 'env', 'allow_subannotations',
|
| - 'trigger_specs', 'timeout', 'infra_step', 'stdout', 'stderr', 'stdin',
|
| - 'ok_ret', 'step_test_data', 'nest_level'))
|
| + ('name', 'base_name', 'cmd', 'cwd', 'env_prefixes', 'env',
|
| + 'allow_subannotations', 'trigger_specs', 'timeout', 'infra_step', 'stdout',
|
| + 'stderr', 'stdin', 'ok_ret', 'step_test_data', 'nest_level'))
|
|
|
| class StepConfig(_StepConfig):
|
| """
|
| @@ -277,6 +277,16 @@ class StepConfig(_StepConfig):
|
| "delete_this": None,
|
| "static_value": "something",
|
| }
|
| +
|
| + The optional "env_prefix" parameter contains values that, if specified, will
|
| + transform an environment variable into a "pathsep"-delimited sequence of
|
| + items:
|
| + - If an environment variable is also specified for this key, it will be
|
| + appended as the last element: <prefix0>:...:<prefixN>:ENV
|
| + - If no enviornment variable is specified, the current environment's value
|
| + will be appended, unless it's empty: <prefix0>:...:<prefixN>[:ENV]?
|
| + - If an enviornment variable with a value of None (delete) is specified,
|
| + nothing will be appeneded: <prefix0>:...:<prefixN>
|
| """
|
|
|
| _RENDER_WHITELIST=frozenset((
|
| @@ -291,10 +301,11 @@ class StepConfig(_StepConfig):
|
| ))
|
|
|
| @classmethod
|
| - def create(cls, name, base_name=None, cmd=None, cwd=None, env=None,
|
| - allow_subannotations=None, trigger_specs=None, timeout=None,
|
| - infra_step=None, stdout=None, stderr=None, stdin=None,
|
| - ok_ret=None, step_test_data=None, step_nest_level=None):
|
| + def create(cls, name, base_name=None, cmd=None, cwd=None, env_prefixes=None,
|
| + env=None, allow_subannotations=None, trigger_specs=None,
|
| + timeout=None, infra_step=None, stdout=None, stderr=None,
|
| + stdin=None, ok_ret=None, step_test_data=None,
|
| + step_nest_level=None):
|
| """
|
| Initializes a new StepConfig step API dictionary.
|
|
|
| @@ -305,6 +316,7 @@ class StepConfig(_StepConfig):
|
| name component of just this step. If None, this will be set to "name".
|
| cmd: command to run. Acceptable types: str, Path, Placeholder, or None.
|
| cwd (str or None): absolute path to working directory for the command
|
| + env_prefixes (dict): environment prefix variables, described above.
|
| env (dict): overrides for environment variables, described above.
|
| allow_subannotations (bool): if True, lets the step emit its own
|
| annotations. NOTE: Enabling this can cause some buggy behavior. Please
|
| @@ -333,7 +345,8 @@ class StepConfig(_StepConfig):
|
| base_name=(base_name or name),
|
| cmd=cmd,
|
| cwd=cwd,
|
| - env=env,
|
| + env_prefixes={k: tuple(v) for k, v in (env_prefixes or {}).iteritems()},
|
| + env=env or {},
|
| allow_subannotations=bool(allow_subannotations),
|
| trigger_specs=[TriggerSpec._create(**trig)
|
| for trig in (trigger_specs or ())],
|
| @@ -349,6 +362,7 @@ class StepConfig(_StepConfig):
|
|
|
| def render_to_dict(self):
|
| self = self._replace(
|
| + env_prefixes={k: list(v) for k, v in self.env_prefixes.iteritems()},
|
| trigger_specs=[trig._render_to_dict()
|
| for trig in (self.trigger_specs or ())],
|
| )
|
|
|