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

Unified Diff: recipe_modules/gclient/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 | « recipe_modules/bot_update/api.py ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: recipe_modules/gclient/api.py
diff --git a/recipe_modules/gclient/api.py b/recipe_modules/gclient/api.py
index 558e9d9c5e68ca10e91ff643162da8dcdb6b2bb2..2d9ed949f5f72d6c78cd16552648245fc63fce81 100644
--- a/recipe_modules/gclient/api.py
+++ b/recipe_modules/gclient/api.py
@@ -50,6 +50,12 @@ class ProjectRevisionResolver(RevisionResolver):
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(
@@ -131,6 +137,10 @@ class GclientApi(recipe_api.RecipeApi):
'CACHE_DIR': self.m.path['git_cache'],
}
+ @staticmethod
+ def config_to_pythonish(cfg):
+ return jsonish_to_python(cfg.as_jsonish(), True)
+
def resolve_revision(self, revision):
if hasattr(revision, 'resolve'):
return revision.resolve(self.m.properties)
@@ -241,9 +251,7 @@ class GclientApi(recipe_api.RecipeApi):
if inject_parent_got_revision:
self.inject_parent_got_revision(cfg, override=True)
- spec_string = jsonish_to_python(cfg.as_jsonish(), True)
-
- self('setup', ['config', '--spec', spec_string], **kwargs)
+ self('setup', ['config', '--spec', self.config_to_pythonish(cfg)], **kwargs)
sync_step = None
try:
« no previous file with comments | « recipe_modules/bot_update/api.py ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698