| OLD | NEW |
| 1 #!/usr/bin/env python | 1 #!/usr/bin/env python |
| 2 # Copyright 2015 The Chromium Authors. All rights reserved. | 2 # Copyright 2015 The Chromium Authors. All rights reserved. |
| 3 # Use of this source code is governed by a BSD-style license that can be | 3 # Use of this source code is governed by a BSD-style license that can be |
| 4 # found in the LICENSE file. | 4 # found in the LICENSE file. |
| 5 | 5 |
| 6 """Tool to interact with recipe repositories. | 6 """Tool to interact with recipe repositories. |
| 7 | 7 |
| 8 This tool operates on the nearest ancestor directory containing an | 8 This tool operates on the nearest ancestor directory containing an |
| 9 infra/config/recipes.cfg. | 9 infra/config/recipes.cfg. |
| 10 """ | 10 """ |
| (...skipping 193 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 204 v[project_id] = path | 204 v[project_id] = path |
| 205 | 205 |
| 206 | 206 |
| 207 def depgraph(package_deps, args): | 207 def depgraph(package_deps, args): |
| 208 from recipe_engine import depgraph | 208 from recipe_engine import depgraph |
| 209 from recipe_engine import loader | 209 from recipe_engine import loader |
| 210 | 210 |
| 211 _, config_file = get_package_config(args) | 211 _, config_file = get_package_config(args) |
| 212 universe = loader.RecipeUniverse(package_deps, config_file) | 212 universe = loader.RecipeUniverse(package_deps, config_file) |
| 213 | 213 |
| 214 depgraph.main(universe, ignore_packages=args.ignore_package, | 214 depgraph.main(universe, package_deps.root_package, |
| 215 stdout=args.output) | 215 args.ignore_package, args.output, args.recipe_filter) |
| 216 | 216 |
| 217 | 217 |
| 218 def doc(package_deps, args): | 218 def doc(package_deps, args): |
| 219 from recipe_engine import doc | 219 from recipe_engine import doc |
| 220 from recipe_engine import loader | 220 from recipe_engine import loader |
| 221 | 221 |
| 222 _, config_file = get_package_config(args) | 222 _, config_file = get_package_config(args) |
| 223 universe = loader.RecipeUniverse(package_deps, config_file) | 223 universe = loader.RecipeUniverse(package_deps, config_file) |
| 224 | 224 |
| 225 doc.main(universe) | 225 doc.main(universe) |
| (...skipping 97 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 323 './recipes.py --package infra/config/recipes.cfg depgraph | tred | ' | 323 './recipes.py --package infra/config/recipes.cfg depgraph | tred | ' |
| 324 'dot -Tpdf > graph.pdf') | 324 'dot -Tpdf > graph.pdf') |
| 325 depgraph_p.set_defaults(command='depgraph') | 325 depgraph_p.set_defaults(command='depgraph') |
| 326 depgraph_p.add_argument( | 326 depgraph_p.add_argument( |
| 327 '--output', type=argparse.FileType('w'), default=sys.stdout, | 327 '--output', type=argparse.FileType('w'), default=sys.stdout, |
| 328 help='The file to write output to') | 328 help='The file to write output to') |
| 329 depgraph_p.add_argument( | 329 depgraph_p.add_argument( |
| 330 '--ignore-package', action='append', default=[], | 330 '--ignore-package', action='append', default=[], |
| 331 help='Ignore a recipe package (e.g. recipe_engine). Can be passed ' | 331 help='Ignore a recipe package (e.g. recipe_engine). Can be passed ' |
| 332 'multiple times') | 332 'multiple times') |
| 333 depgraph_p.add_argument( |
| 334 '--recipe-filter', default='', |
| 335 help='A recipe substring to examine. If present, the depgraph will ' |
| 336 'include a recipe section containing recipes whose names contain ' |
| 337 'this substring. It will also filter all nodes of the graph to only ' |
| 338 'include modules touched by the filtered recipes.') |
| 333 | 339 |
| 334 doc_p = subp.add_parser( | 340 doc_p = subp.add_parser( |
| 335 'doc', | 341 'doc', |
| 336 help='List all known modules reachable from the current package with ' | 342 help='List all known modules reachable from the current package with ' |
| 337 'various info about each') | 343 'various info about each') |
| 338 doc_p.set_defaults(command='doc') | 344 doc_p.set_defaults(command='doc') |
| 339 | 345 |
| 340 info_p = subp.add_parser( | 346 info_p = subp.add_parser( |
| 341 'info', | 347 'info', |
| 342 help='Query information about the current recipe package') | 348 help='Query information about the current recipe package') |
| (...skipping 45 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 388 | 394 |
| 389 Warmly, | 395 Warmly, |
| 390 recipes.py | 396 recipes.py |
| 391 """ | 397 """ |
| 392 return 1 | 398 return 1 |
| 393 | 399 |
| 394 return 0 | 400 return 0 |
| 395 | 401 |
| 396 if __name__ == '__main__': | 402 if __name__ == '__main__': |
| 397 sys.exit(main()) | 403 sys.exit(main()) |
| OLD | NEW |