| OLD | NEW |
| 1 #!/usr/bin/env python | 1 #!/usr/bin/env python |
| 2 # Copyright 2013 The Chromium Authors. All rights reserved. | 2 # Copyright 2013 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 from __future__ import print_function | 6 from __future__ import print_function |
| 7 | 7 |
| 8 import collections | 8 import collections |
| 9 import inspect | 9 import inspect |
| 10 import os | 10 import os |
| 11 import sys | 11 import sys |
| 12 | 12 |
| 13 sys.path.append(os.path.join(os.path.dirname(__file__), '..')) | 13 sys.path.append(os.path.join(os.path.dirname(__file__), '..')) |
| 14 sys.path.append(os.path.join(os.path.dirname(__file__), | 14 sys.path.append(os.path.join(os.path.dirname(__file__), |
| 15 '..', '..', 'third_party')) | 15 '..', '..', 'third_party')) |
| 16 | 16 |
| 17 from recipe_engine import loader |
| 17 from recipe_engine import main as recipe_main | 18 from recipe_engine import main as recipe_main |
| 19 from recipe_engine import package |
| 18 from recipe_engine import recipe_api | 20 from recipe_engine import recipe_api |
| 19 from recipe_engine import loader | |
| 20 | 21 |
| 21 from slave import recipe_universe | 22 PACKAGE_PYL = os.path.join( |
| 23 os.path.dirname(os.path.dirname(os.path.abspath(__file__))), |
| 24 'slave', 'recipe_package.pyl') |
| 22 | 25 |
| 23 def trim_doc(docstring): | 26 def trim_doc(docstring): |
| 24 """From PEP 257""" | 27 """From PEP 257""" |
| 25 if not docstring: | 28 if not docstring: |
| 26 return '' | 29 return '' |
| 27 # Convert tabs to spaces (following the normal Python rules) | 30 # Convert tabs to spaces (following the normal Python rules) |
| 28 # and split into a list of lines: | 31 # and split into a list of lines: |
| 29 lines = docstring.expandtabs().splitlines() | 32 lines = docstring.expandtabs().splitlines() |
| 30 # Determine minimum indentation (first line doesn't count): | 33 # Determine minimum indentation (first line doesn't count): |
| 31 indent = sys.maxint | 34 indent = sys.maxint |
| (...skipping 47 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 79 p(0, '--', lines[0]) | 82 p(0, '--', lines[0]) |
| 80 else: | 83 else: |
| 81 p(0) | 84 p(0) |
| 82 | 85 |
| 83 def main(): | 86 def main(): |
| 84 common_methods = set(k for k, v in member_iter(recipe_api.RecipeApi)) | 87 common_methods = set(k for k, v in member_iter(recipe_api.RecipeApi)) |
| 85 p(0, 'Common Methods -- %s' % os.path.splitext(recipe_api.__file__)[0]) | 88 p(0, 'Common Methods -- %s' % os.path.splitext(recipe_api.__file__)[0]) |
| 86 for method in sorted(common_methods): | 89 for method in sorted(common_methods): |
| 87 pmethod(1, method, getattr(recipe_api.RecipeApi, method)) | 90 pmethod(1, method, getattr(recipe_api.RecipeApi, method)) |
| 88 | 91 |
| 89 universe = recipe_universe.get_universe() | 92 universe = loader.RecipeUniverse(package.PackageDeps.create(PACKAGE_PYL)) |
| 90 deps = universe.deps_from_paths( | 93 deps = universe.deps_from_spec( |
| 91 { modpath: modpath | 94 # TODO(luqui): This doesn't handle name scoping correctly (e.g. same-named |
| 92 for modpath in universe.loop_over_recipe_modules() }, | 95 # modules in different packages). |
| 93 base_path=None) | 96 { modpath: modpath.split('/')[-1] |
| 97 for modpath in universe.loop_over_recipe_modules() }) |
| 94 | 98 |
| 95 inst = loader.create_recipe_api( | 99 inst = loader.create_recipe_api( |
| 96 deps, recipe_main.SequentialRecipeEngine(None, {}, None)) | 100 deps, recipe_main.SequentialRecipeEngine(None, {}, None)) |
| 97 | 101 |
| 98 for mod_name, mod in deps.iteritems(): | 102 for mod_name, mod in deps.iteritems(): |
| 99 p(0) | 103 p(0) |
| 100 p(0, "(%s) -- %s" % (mod_name, mod.__path__[0])) | 104 p(0, "(%s) -- %s" % (mod_name, mod.__path__[0])) |
| 101 if mod.LOADED_DEPS: | 105 if mod.LOADED_DEPS: |
| 102 p(1, 'DEPS:', list(mod.LOADED_DEPS)) | 106 p(1, 'DEPS:', list(mod.LOADED_DEPS)) |
| 103 | 107 |
| (...skipping 11 matching lines...) Expand all Loading... |
| 115 p(2, '"', line) | 119 p(2, '"', line) |
| 116 | 120 |
| 117 for fn_name, obj in member_iter(subinst): | 121 for fn_name, obj in member_iter(subinst): |
| 118 if fn_name in base_fns: | 122 if fn_name in base_fns: |
| 119 continue | 123 continue |
| 120 pmethod(1, fn_name, obj) | 124 pmethod(1, fn_name, obj) |
| 121 | 125 |
| 122 | 126 |
| 123 if __name__ == '__main__': | 127 if __name__ == '__main__': |
| 124 main() | 128 main() |
| OLD | NEW |