Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(63)

Unified Diff: recipe_modules/context/api.py

Issue 2913203002: [step_runner] run _merge_envs in simulation too. (Closed)
Patch Set: Created 3 years, 7 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
Index: recipe_modules/context/api.py
diff --git a/recipe_modules/context/api.py b/recipe_modules/context/api.py
index de7075670061fff5f591ada696c4515c01121531..33556301a8b156b43ce092068f5f8fa7a9acfbfe 100644
--- a/recipe_modules/context/api.py
+++ b/recipe_modules/context/api.py
@@ -25,6 +25,7 @@ Example:
"""
+import collections
import copy
from contextlib import contextmanager
@@ -137,8 +138,18 @@ class ContextApi(RecipeApi):
check_type('env', env, dict)
# strify everything except None in the env to allow for ints, Paths, etc.
# None has special meaning (i.e. "delete this env key")
- kwargs['env'] = {str(k): (str(v) if v is not None else None)
- for k, v in env.iteritems()}
+ new_env = {}
+ for k, v in env.iteritems():
+ k = str(k)
+ if v is not None:
+ v = str(v)
+ try:
+ v % collections.defaultdict(str)
nodir 2017/05/31 21:49:03 it does not fail for v==`%s'
iannucci 2017/05/31 22:07:55 Done.
+ except Exception:
+ raise ValueError(('Invalid %%-formatting parameter in envvar, '
+ 'only %%(ENVVAR)s allowed: %r') % (v,))
+ new_env[k] = v
+ kwargs['env'] = new_env
if not kwargs:
yield

Powered by Google App Engine
This is Rietveld 408576698