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

Side by Side Diff: doc/recipes.py

Issue 2782323002: make doc/recipes.py supported version 1 and 2 (Closed)
Patch Set: todo 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') | 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 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:
71 (d for d in pb['deps'] if d['project_id'] == 'recipe_engine'), None) 71 # TODO(iannucci): remove when we only support version 2
72 if engine is None: 72 engine = next(
73 raise ValueError('could not find recipe_engine dep in %r' 73 (d for d in pb['deps'] if d['project_id'] == 'recipe_engine'), None)
74 % recipes_cfg_path) 74 if engine is None:
75 raise ValueError('could not find recipe_engine dep in %r'
76 % recipes_cfg_path)
77 else:
78 engine = pb['deps']['recipe_engine']
75 engine_url = engine['url'] 79 engine_url = engine['url']
76 engine_revision = engine.get('revision', '') 80 engine_revision = engine.get('revision', '')
77 engine_subpath = engine.get('path_override', '') 81 engine_subpath = engine.get('path_override', '')
78 recipes_path = pb.get('recipes_path', '') 82 recipes_path = pb.get('recipes_path', '')
79 83
80 recipes_path = os.path.join(repo_root, recipes_path.replace('/', os.path.sep)) 84 recipes_path = os.path.join(repo_root, recipes_path.replace('/', os.path.sep))
81 return engine_url, engine_revision, engine_subpath, recipes_path 85 return engine_url, engine_revision, engine_subpath, recipes_path
82 86
83 87
84 def _subprocess_call(argv, **kwargs): 88 def _subprocess_call(argv, **kwargs):
(...skipping 77 matching lines...) Expand 10 before | Expand all | Expand 10 after
162 time.sleep(random.uniform(2,5)) 166 time.sleep(random.uniform(2,5))
163 ensure_engine() 167 ensure_engine()
164 168
165 args = ['--package', recipes_cfg_path] + sys.argv[1:] 169 args = ['--package', recipes_cfg_path] + sys.argv[1:]
166 return _subprocess_call([ 170 return _subprocess_call([
167 sys.executable, '-u', 171 sys.executable, '-u',
168 os.path.join(engine_path, 'recipes.py')] + args) 172 os.path.join(engine_path, 'recipes.py')] + args)
169 173
170 if __name__ == '__main__': 174 if __name__ == '__main__':
171 sys.exit(main()) 175 sys.exit(main())
OLDNEW
« no previous file with comments | « no previous file | unittests/repo_test_util.py » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698