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

Side by Side 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 unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 #!/usr/bin/env python 1 #!/usr/bin/env python
2 2
3 # Copyright 2016 The LUCI Authors. All rights reserved. 3 # Copyright 2016 The LUCI Authors. All rights reserved.
4 # Use of this source code is governed under the Apache License, Version 2.0 4 # Use of this source code is governed under the Apache License, Version 2.0
5 # that can be found in the LICENSE file. 5 # that can be found in the LICENSE file.
6 6
7 """Bootstrap script to clone and forward to the recipe engine tool. 7 """Bootstrap script to clone and forward to the recipe engine tool.
8 8
9 *********************************************************************** 9 ***********************************************************************
10 ** DO NOT MODIFY EXCEPT IN THE PER-REPO CONFIGURATION SECTION BELOW. ** 10 ** DO NOT MODIFY EXCEPT IN THE PER-REPO CONFIGURATION SECTION BELOW. **
(...skipping 33 matching lines...) Expand 10 before | Expand all | Expand 10 after
44 repo. 44 repo.
45 45
46 We assume all fields are repeated since we don't have a proto spec to work 46 We assume all fields are repeated since we don't have a proto spec to work
47 with. 47 with.
48 48
49 Args: 49 Args:
50 fh: a filehandle containing the text format protobuf. 50 fh: a filehandle containing the text format protobuf.
51 Returns: 51 Returns:
52 A recursive dictionary of lists. 52 A recursive dictionary of lists.
53 """ 53 """
54 def parse_atom(text): 54 def parse_atom(field, text):
55 if text == 'true': 55 if text == 'true':
56 return True 56 return True
57 if text == 'false': 57 if text == 'false':
58 return False 58 return False
59
60 # repo_type is an enum. Since it does not have quotes,
61 # invoking literal_eval would fail.
62 if field == 'repo_type':
63 return text
64
59 return ast.literal_eval(text) 65 return ast.literal_eval(text)
60 66
61 ret = {} 67 ret = {}
62 for line in fh: 68 for line in fh:
63 line = line.strip() 69 line = line.strip()
64 m = re.match(r'(\w+)\s*:\s*(.*)', line) 70 m = re.match(r'(\w+)\s*:\s*(.*)', line)
65 if m: 71 if m:
66 ret.setdefault(m.group(1), []).append(parse_atom(m.group(2))) 72 ret.setdefault(m.group(1), []).append(parse_atom(m.group(1), m.group(2)))
67 continue 73 continue
68 74
69 m = re.match(r'(\w+)\s*{', line) 75 m = re.match(r'(\w+)\s*{', line)
70 if m: 76 if m:
71 subparse = parse_protobuf(fh) 77 subparse = parse_protobuf(fh)
72 ret.setdefault(m.group(1), []).append(subparse) 78 ret.setdefault(m.group(1), []).append(subparse)
73 continue 79 continue
74 80
75 if line == '}': 81 if line == '}':
76 return ret 82 return ret
(...skipping 79 matching lines...) Expand 10 before | Expand all | Expand 10 after
156 ensure_engine() 162 ensure_engine()
157 163
158 args = ['--package', recipes_cfg_path, 164 args = ['--package', recipes_cfg_path,
159 '--bootstrap-script', __file__] + sys.argv[1:] 165 '--bootstrap-script', __file__] + sys.argv[1:]
160 return _subprocess_call([ 166 return _subprocess_call([
161 sys.executable, '-u', 167 sys.executable, '-u',
162 os.path.join(engine_path, engine_subpath, 'recipes.py')] + args) 168 os.path.join(engine_path, engine_subpath, 'recipes.py')] + args)
163 169
164 if __name__ == '__main__': 170 if __name__ == '__main__':
165 sys.exit(main()) 171 sys.exit(main())
OLDNEW
« 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