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: |