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

Side by Side Diff: doc/recipes.py

Issue 2782323002: make doc/recipes.py supported version 1 and 2 (Closed)
Patch Set: move exception Created 3 years, 8 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
« no previous file with comments | « no previous file | unittests/repo_test_util.py » ('j') | unittests/repo_test_util.py » ('J')
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 49 matching lines...) Expand 10 before | Expand all | Expand 10 after
60 essentially always be empty. It would be used if the recipes-py repo was 60 essentially always be empty. It would be used if the recipes-py repo was
61 merged as a subdirectory of some other repo and you depended on that 61 merged as a subdirectory of some other repo and you depended on that
62 subdirectory. 62 subdirectory.
63 recipes_path (str) - native path to where the recipes live inside of the 63 recipes_path (str) - native path to where the recipes live inside of the
64 current repo (i.e. the folder containing `recipes/` and/or 64 current repo (i.e. the folder containing `recipes/` and/or
65 `recipe_modules`) 65 `recipe_modules`)
66 """ 66 """
67 with open(recipes_cfg_path, 'rU') as fh: 67 with open(recipes_cfg_path, 'rU') as fh:
68 pb = json.load(fh) 68 pb = json.load(fh)
69 69
70 engine = next( 70 if pb['api_version'] == 1:
iannucci 2017/03/29 22:15:08 This section will go away when we only support ver
dnj 2017/03/29 22:16:15 Add a TODO then?
iannucci 2017/03/29 22:17:20 Done
71 (d for d in pb['deps'] if d['project_id'] == 'recipe_engine'), None) 71 engine = next(
72 if engine is None: 72 (d for d in pb['deps'] if d['project_id'] == 'recipe_engine'), None)
73 raise ValueError('could not find recipe_engine dep in %r' 73 if engine is None:
74 % recipes_cfg_path) 74 raise ValueError('could not find recipe_engine dep in %r'
75 % recipes_cfg_path)
76 else:
77 engine = pb['deps']['recipe_engine']
75 engine_url = engine['url'] 78 engine_url = engine['url']
76 engine_revision = engine.get('revision', '') 79 engine_revision = engine.get('revision', '')
77 engine_subpath = engine.get('path_override', '') 80 engine_subpath = engine.get('path_override', '')
78 recipes_path = pb.get('recipes_path', '') 81 recipes_path = pb.get('recipes_path', '')
79 82
80 recipes_path = os.path.join(repo_root, recipes_path.replace('/', os.path.sep)) 83 recipes_path = os.path.join(repo_root, recipes_path.replace('/', os.path.sep))
81 return engine_url, engine_revision, engine_subpath, recipes_path 84 return engine_url, engine_revision, engine_subpath, recipes_path
82 85
83 86
84 def _subprocess_call(argv, **kwargs): 87 def _subprocess_call(argv, **kwargs):
(...skipping 77 matching lines...) Expand 10 before | Expand all | Expand 10 after
162 time.sleep(random.uniform(2,5)) 165 time.sleep(random.uniform(2,5))
163 ensure_engine() 166 ensure_engine()
164 167
165 args = ['--package', recipes_cfg_path] + sys.argv[1:] 168 args = ['--package', recipes_cfg_path] + sys.argv[1:]
166 return _subprocess_call([ 169 return _subprocess_call([
167 sys.executable, '-u', 170 sys.executable, '-u',
168 os.path.join(engine_path, 'recipes.py')] + args) 171 os.path.join(engine_path, 'recipes.py')] + args)
169 172
170 if __name__ == '__main__': 173 if __name__ == '__main__':
171 sys.exit(main()) 174 sys.exit(main())
OLDNEW
« no previous file with comments | « no previous file | unittests/repo_test_util.py » ('j') | unittests/repo_test_util.py » ('J')

Powered by Google App Engine
This is Rietveld 408576698