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

Unified Diff: recipes.py

Issue 2249943004: upload recipe bootstrap script (6a4b2e4) (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/tools/depot_tools
Patch Set: Created 4 years, 4 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 | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: recipes.py
diff --git a/recipes.py b/recipes.py
index f83aaddb0d372a7ff191507c4bbaeaf20b19791a..79ca537dc1c27405b288397cb236bdf1a5b4c020 100755
--- a/recipes.py
+++ b/recipes.py
@@ -51,11 +51,17 @@ def parse_protobuf(fh):
Returns:
A recursive dictionary of lists.
"""
- def parse_atom(text):
+ def parse_atom(field, text):
if text == 'true':
return True
if text == 'false':
return False
+
+ # repo_type is an enum. Since it does not have quotes,
+ # invoking literal_eval would fail.
+ if field == 'repo_type':
+ return text
+
return ast.literal_eval(text)
ret = {}
@@ -63,7 +69,7 @@ def parse_protobuf(fh):
line = line.strip()
m = re.match(r'(\w+)\s*:\s*(.*)', line)
if m:
- ret.setdefault(m.group(1), []).append(parse_atom(m.group(2)))
+ ret.setdefault(m.group(1), []).append(parse_atom(m.group(1), m.group(2)))
continue
m = re.match(r'(\w+)\s*{', line)
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698