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

Unified Diff: recipe_modules/bot_update/api.py

Issue 1815863002: Make the config -> pythonish conversion a gclient module function. (Closed) Base URL: https://chromium.googlesource.com/chromium/tools/depot_tools.git@master
Patch Set: Created 4 years, 9 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
« no previous file with comments | « no previous file | recipe_modules/gclient/api.py » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: recipe_modules/bot_update/api.py
diff --git a/recipe_modules/bot_update/api.py b/recipe_modules/bot_update/api.py
index 26367bb851c242a0703b8baf7668ce04da98412d..2b64807e5ec34f90ddb7da97967f72ae81046834 100644
--- a/recipe_modules/bot_update/api.py
+++ b/recipe_modules/bot_update/api.py
@@ -15,37 +15,6 @@ SVN_MASTERS = (
)
-def jsonish_to_python(spec, is_top=False):
- """Turn a json spec into a python parsable object.
-
- This exists because Gclient specs, while resembling json, is actually
- ingested using a python "eval()". Therefore a bit of plumming is required
- to turn our newly constructed Gclient spec into a gclient-readable spec.
- """
- ret = ''
- if is_top: # We're the 'top' level, so treat this dict as a suite.
- ret = '\n'.join(
- '%s = %s' % (k, jsonish_to_python(spec[k])) for k in sorted(spec)
- )
- else:
- if isinstance(spec, dict):
- ret += '{'
- ret += ', '.join(
- "%s: %s" % (repr(str(k)), jsonish_to_python(spec[k]))
- for k in sorted(spec)
- )
- ret += '}'
- elif isinstance(spec, list):
- ret += '['
- ret += ', '.join(jsonish_to_python(x) for x in spec)
- ret += ']'
- elif isinstance(spec, basestring):
- ret = repr(str(spec))
- else:
- ret = repr(spec)
- return ret
-
-
class BotUpdateApi(recipe_api.RecipeApi):
def __init__(self, mastername, buildername, slavename, issue, patchset,
@@ -107,7 +76,6 @@ class BotUpdateApi(recipe_api.RecipeApi):
# We can re-use the gclient spec from the gclient module, since all the
# data bot_update needs is already configured into the gclient spec.
cfg = gclient_config or self.m.gclient.c
- spec_string = jsonish_to_python(cfg.as_jsonish(), True)
# Used by bot_update to determine if we want to run or not.
master = self._mastername
@@ -169,7 +137,7 @@ class BotUpdateApi(recipe_api.RecipeApi):
['--slave', slave],
# 2. What do we want to check out (spec/root/rev/rev_map).
- ['--spec', spec_string],
+ ['--spec', self.m.gclient.config_to_pythonish(cfg)],
['--root', root],
['--revision_mapping_file', self.m.json.input(rev_map)],
['--git-cache-dir', cfg.cache_dir],
« no previous file with comments | « no previous file | recipe_modules/gclient/api.py » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698