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

Side by Side Diff: recipe_engine/depgraph.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 | « recipe_engine/bundle.py ('k') | recipe_engine/doc.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 sys 7 import sys
8 8
9 from . import loader 9 from . import loader
10 10
(...skipping 30 matching lines...) Expand all
41 'Ignore a recipe package (e.g. recipe_engine). Can be passed ' 41 'Ignore a recipe package (e.g. recipe_engine). Can be passed '
42 'multiple times')) 42 'multiple times'))
43 depgraph_p.add_argument( 43 depgraph_p.add_argument(
44 '--recipe-filter', default='', 44 '--recipe-filter', default='',
45 help=( 45 help=(
46 'A recipe substring to examine. If present, the depgraph will ' 46 'A recipe substring to examine. If present, the depgraph will '
47 'include a recipe section containing recipes whose names contain ' 47 'include a recipe section containing recipes whose names contain '
48 'this substring. It will also filter all nodes of the graph to only ' 48 'this substring. It will also filter all nodes of the graph to only '
49 'include modules touched by the filtered recipes.')) 49 'include modules touched by the filtered recipes.'))
50 50
51 depgraph_p.set_defaults(command='depgraph', func=main) 51 depgraph_p.set_defaults(func=main)
52 52
53 53
54 def main(package_deps, args): 54 def main(package_deps, args):
55 universe = loader.RecipeUniverse(package_deps, args.package) 55 universe = loader.RecipeUniverse(package_deps, args.package)
56 own_package = package_deps.root_package 56 own_package = package_deps.root_package
57 57
58 module_to_package = {} 58 module_to_package = {}
59 59
60 # All deps maps a tuple of (is_recipe, id) to deps (list of ids). is_recipe is 60 # All deps maps a tuple of (is_recipe, id) to deps (list of ids). is_recipe is
61 # a boolean, all ids are strings. 61 # a boolean, all ids are strings.
(...skipping 80 matching lines...) Expand 10 before | Expand all | Expand 10 after
142 print(' subgraph "cluster_%s" { label="%s"; %s; }' % ( 142 print(' subgraph "cluster_%s" { label="%s"; %s; }' % (
143 package, package, '; '.join(modules)), file=args.output) 143 package, package, '; '.join(modules)), file=args.output)
144 144
145 if args.recipe_filter and recipe_to_package: 145 if args.recipe_filter and recipe_to_package:
146 recipe_names = [ 146 recipe_names = [
147 '"recipe %s"' % name for name in recipe_to_package.keys()] 147 '"recipe %s"' % name for name in recipe_to_package.keys()]
148 print(' subgraph "cluster_recipes" { label="recipes"; %s; }' % ( 148 print(' subgraph "cluster_recipes" { label="recipes"; %s; }' % (
149 '; '.join(recipe_names)), file=args.output) 149 '; '.join(recipe_names)), file=args.output)
150 150
151 print(_GRAPH_FOOTER, file=args.output) 151 print(_GRAPH_FOOTER, file=args.output)
OLDNEW
« no previous file with comments | « recipe_engine/bundle.py ('k') | recipe_engine/doc.py » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698