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