| OLD | NEW |
| 1 #!/usr/bin/env python | 1 #!/usr/bin/env python |
| 2 # Copyright 2013 The LUCI Authors. All rights reserved. | 2 # Copyright 2013 The LUCI Authors. All rights reserved. |
| 3 # Use of this source code is governed under the Apache License, Version 2.0 | 3 # Use of this source code is governed under the Apache License, Version 2.0 |
| 4 # that can be found in the LICENSE file. | 4 # that can be 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 81 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 92 common_methods = set(k for k, v in member_iter(recipe_api.RecipeApi)) | 92 common_methods = set(k for k, v in member_iter(recipe_api.RecipeApi)) |
| 93 p(0, 'Common Methods -- %s' % os.path.splitext(recipe_api.__file__)[0]) | 93 p(0, 'Common Methods -- %s' % os.path.splitext(recipe_api.__file__)[0]) |
| 94 for method in sorted(common_methods): | 94 for method in sorted(common_methods): |
| 95 pmethod(1, method, getattr(recipe_api.RecipeApi, method)) | 95 pmethod(1, method, getattr(recipe_api.RecipeApi, method)) |
| 96 | 96 |
| 97 deps = {} | 97 deps = {} |
| 98 universe = universe_view.universe | 98 universe = universe_view.universe |
| 99 for module_name in universe_view.loop_over_recipe_modules(): | 99 for module_name in universe_view.loop_over_recipe_modules(): |
| 100 deps[module_name] = universe.load(universe_view.package, module_name) | 100 deps[module_name] = universe.load(universe_view.package, module_name) |
| 101 | 101 |
| 102 rt = recipe_run.Runtime({}) |
| 102 inst = loader.create_recipe_api( | 103 inst = loader.create_recipe_api( |
| 103 deps, recipe_run.RecipeEngine(None, {}, universe)) | 104 deps, recipe_run.RecipeEngine(None, rt, universe)) |
| 104 | 105 |
| 105 for mod_name, mod in sorted(deps.iteritems(), key=lambda it: it[0]): | 106 for mod_name, mod in sorted(deps.iteritems(), key=lambda it: it[0]): |
| 106 p(0) | 107 p(0) |
| 107 p(0, "(%s) -- %s" % (mod_name, mod.__path__[0])) | 108 p(0, "(%s) -- %s" % (mod_name, mod.__path__[0])) |
| 108 if mod.LOADED_DEPS: | 109 if mod.LOADED_DEPS: |
| 109 p(1, 'DEPS:', list(mod.LOADED_DEPS)) | 110 p(1, 'DEPS:', list(mod.LOADED_DEPS)) |
| 110 | 111 |
| 111 subinst = getattr(inst, mod_name) | 112 subinst = getattr(inst, mod_name) |
| 112 bases = set(subinst.__class__.__bases__) | 113 bases = set(subinst.__class__.__bases__) |
| 113 base_fns = set() | 114 base_fns = set() |
| 114 for base in bases: | 115 for base in bases: |
| 115 for name, _ in inspect.getmembers(base): | 116 for name, _ in inspect.getmembers(base): |
| 116 base_fns.add(name) | 117 base_fns.add(name) |
| 117 for cool_base in bases - set((recipe_api.RecipeApi,)): | 118 for cool_base in bases - set((recipe_api.RecipeApi,)): |
| 118 p(1, 'behaves like %s' % map_to_cool_name(cool_base)) | 119 p(1, 'behaves like %s' % map_to_cool_name(cool_base)) |
| 119 | 120 |
| 120 if mod.API.__doc__: | 121 if mod.API.__doc__: |
| 121 for line in trim_doc(mod.API.__doc__): | 122 for line in trim_doc(mod.API.__doc__): |
| 122 p(2, '"', line) | 123 p(2, '"', line) |
| 123 | 124 |
| 124 for fn_name, obj in member_iter(subinst): | 125 for fn_name, obj in member_iter(subinst): |
| 125 if fn_name in base_fns: | 126 if fn_name in base_fns: |
| 126 continue | 127 continue |
| 127 pmethod(1, fn_name, obj) | 128 pmethod(1, fn_name, obj) |
| OLD | NEW |