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

Side by Side Diff: recipe_engine/autoroll.py

Issue 2845923002: [recipes.py] use argparse to set command automatically. (Closed)
Patch Set: rebase Created 3 years, 7 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 | recipe_engine/bundle.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 # Copyright 2016 The LUCI Authors. All rights reserved. 1 # Copyright 2016 The LUCI Authors. All rights reserved.
2 # Use of this source code is governed under the Apache License, Version 2.0 2 # Use of this source code is governed under the Apache License, Version 2.0
3 # that can be found in the LICENSE file. 3 # that can be found in the LICENSE file.
4 4
5 from __future__ import print_function 5 from __future__ import print_function
6 6
7 import copy 7 import copy
8 import json 8 import json
9 import logging 9 import logging
10 import os 10 import os
(...skipping 275 matching lines...) Expand 10 before | Expand all | Expand 10 after
286 'Requires --output-json.')) 286 'Requires --output-json.'))
287 287
288 def postprocess_func(parser, args): 288 def postprocess_func(parser, args):
289 if args.no_fetch: 289 if args.no_fetch:
290 parser.error('autoroll with --no-fetch does not make sense.') 290 parser.error('autoroll with --no-fetch does not make sense.')
291 291
292 if args.verbose_json and not args.output_json: 292 if args.verbose_json and not args.output_json:
293 parser.error('--verbose-json passed without --output-json') 293 parser.error('--verbose-json passed without --output-json')
294 294
295 autoroll_p.set_defaults( 295 autoroll_p.set_defaults(
296 command='autoroll', func=main, postprocess_func=postprocess_func) 296 func=main, postprocess_func=postprocess_func)
297 297
298 298
299 def main(_package_deps, args): 299 def main(_package_deps, args):
300 config_file = args.package 300 config_file = args.package
301 repo_root = package.InfraRepoConfig().from_recipes_cfg(config_file.path) 301 repo_root = package.InfraRepoConfig().from_recipes_cfg(config_file.path)
302 302
303 package_pb = config_file.read() 303 package_pb = config_file.read()
304 304
305 context = package.PackageContext.from_package_pb( 305 context = package.PackageContext.from_package_pb(
306 repo_root, package_pb, allow_fetch=not args.no_fetch) 306 repo_root, package_pb, allow_fetch=not args.no_fetch)
(...skipping 12 matching lines...) Expand all
319 # Restore initial state. Since we could be running simulation tests 319 # Restore initial state. Since we could be running simulation tests
320 # on other revisions, re-run them now as well. 320 # on other revisions, re-run them now as well.
321 write_spec_to_disk(context, repo_cfg_block, config_file, package_pb) 321 write_spec_to_disk(context, repo_cfg_block, config_file, package_pb)
322 run_simulation_test(repo_root, package_spec.recipes_path, ['train']) 322 run_simulation_test(repo_root, package_spec.recipes_path, ['train'])
323 323
324 if args.output_json: 324 if args.output_json:
325 with args.output_json: 325 with args.output_json:
326 json.dump(results, args.output_json, sort_keys=True, indent=2) 326 json.dump(results, args.output_json, sort_keys=True, indent=2)
327 327
328 return 0 328 return 0
OLDNEW
« no previous file with comments | « no previous file | recipe_engine/bundle.py » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698