| 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 |
| (...skipping 66 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 77 lines = trim_doc(obj.__doc__) | 77 lines = trim_doc(obj.__doc__) |
| 78 p(0, '--', lines[0]) | 78 p(0, '--', lines[0]) |
| 79 else: | 79 else: |
| 80 p(0) | 80 p(0) |
| 81 | 81 |
| 82 def main(): | 82 def main(): |
| 83 common_methods = set(k for k, v in member_iter(recipe_api.RecipeApi)) | 83 common_methods = set(k for k, v in member_iter(recipe_api.RecipeApi)) |
| 84 p(0, 'Common Methods -- %s' % os.path.splitext(recipe_api.__file__)[0]) | 84 p(0, 'Common Methods -- %s' % os.path.splitext(recipe_api.__file__)[0]) |
| 85 for method in sorted(common_methods): | 85 for method in sorted(common_methods): |
| 86 pmethod(1, method, getattr(recipe_api.RecipeApi, method)) | 86 pmethod(1, method, getattr(recipe_api.RecipeApi, method)) |
| 87 RECIPE_MODULES = recipe_loader.load_recipe_modules(recipe_util.MODULE_DIRS()) | 87 |
| 88 universe = recipe_loader.RecipeUniverse() |
| 89 deps = universe.deps_from_paths( |
| 90 { modpath: modpath |
| 91 for modpath in recipe_loader.loop_over_recipe_modules() }, |
| 92 base_path=None) |
| 88 | 93 |
| 89 inst = recipe_loader.create_recipe_api( | 94 inst = recipe_loader.create_recipe_api( |
| 90 [mod_name for mod_name, mod in member_iter(RECIPE_MODULES)], | 95 deps, annotated_run.SequentialRecipeEngine(None, {}, None)) |
| 91 annotated_run.SequentialRecipeEngine(None, {}, None)) | |
| 92 | 96 |
| 93 for mod_name, mod in member_iter(RECIPE_MODULES): | 97 for mod_name, mod in deps.iteritems(): |
| 94 p(0) | 98 p(0) |
| 95 p(0, "(%s) -- %s" % (mod_name, mod.__path__[0])) | 99 p(0, "(%s) -- %s" % (mod_name, mod.__path__[0])) |
| 96 if mod.DEPS: | 100 if mod.LOADED_DEPS: |
| 97 p(1, 'DEPS:', list(mod.DEPS)) | 101 p(1, 'DEPS:', list(mod.LOADED_DEPS)) |
| 98 | 102 |
| 99 subinst = getattr(inst, mod_name) | 103 subinst = getattr(inst, mod_name) |
| 100 bases = set(subinst.__class__.__bases__) | 104 bases = set(subinst.__class__.__bases__) |
| 101 base_fns = set() | 105 base_fns = set() |
| 102 for base in bases: | 106 for base in bases: |
| 103 for name, _ in inspect.getmembers(base): | 107 for name, _ in inspect.getmembers(base): |
| 104 base_fns.add(name) | 108 base_fns.add(name) |
| 105 for cool_base in bases - set((recipe_api.RecipeApi,)): | 109 for cool_base in bases - set((recipe_api.RecipeApi,)): |
| 106 p(1, 'behaves like %s' % map_to_cool_name(cool_base)) | 110 p(1, 'behaves like %s' % map_to_cool_name(cool_base)) |
| 107 | 111 |
| 108 if mod.API.__doc__: | 112 if mod.API.__doc__: |
| 109 for line in trim_doc(mod.API.__doc__): | 113 for line in trim_doc(mod.API.__doc__): |
| 110 p(2, '"', line) | 114 p(2, '"', line) |
| 111 | 115 |
| 112 for fn_name, obj in member_iter(subinst): | 116 for fn_name, obj in member_iter(subinst): |
| 113 if fn_name in base_fns: | 117 if fn_name in base_fns: |
| 114 continue | 118 continue |
| 115 pmethod(1, fn_name, obj) | 119 pmethod(1, fn_name, obj) |
| 116 | 120 |
| 117 | 121 |
| 118 if __name__ == '__main__': | 122 if __name__ == '__main__': |
| 119 main() | 123 main() |
| OLD | NEW |