Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(485)

Side by Side Diff: recipe_engine/doc.py

Issue 2669033007: [recipe_engine] Fix a couple path-related bugs. (Closed)
Patch Set: Fix remainder of presubmit tests Created 3 years, 10 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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 83 matching lines...) Expand 10 before | Expand all | Expand 10 after
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 inst = loader.create_recipe_api( 102 inst = loader.create_recipe_api(
103 universe.package_deps.root_package, 103 universe.package_deps.root_package,
104 deps, "fake_doc_recipe.py", recipe_run.RecipeEngine(None, {}, universe)) 104 deps, "fake_doc_recipe.py", recipe_run.RecipeEngine(
105 None, {}, universe_view))
iannucci 2017/02/03 00:00:05 So... this has always been wrong and just miraculo
105 106
106 for mod_name, mod in sorted(deps.iteritems(), key=lambda it: it[0]): 107 for mod_name, mod in sorted(deps.iteritems(), key=lambda it: it[0]):
107 p(0) 108 p(0)
108 p(0, "(%s) -- %s" % (mod_name, mod.__path__[0])) 109 p(0, "(%s) -- %s" % (mod_name, mod.__path__[0]))
109 if mod.LOADED_DEPS: 110 if mod.LOADED_DEPS:
110 p(1, 'DEPS:', list(mod.LOADED_DEPS)) 111 p(1, 'DEPS:', list(mod.LOADED_DEPS))
111 112
112 subinst = getattr(inst, mod_name) 113 subinst = getattr(inst, mod_name)
113 bases = set(subinst.__class__.__bases__) 114 bases = set(subinst.__class__.__bases__)
114 base_fns = set() 115 base_fns = set()
115 for base in bases: 116 for base in bases:
116 for name, _ in inspect.getmembers(base): 117 for name, _ in inspect.getmembers(base):
117 base_fns.add(name) 118 base_fns.add(name)
118 for cool_base in bases - set((recipe_api.RecipeApi,)): 119 for cool_base in bases - set((recipe_api.RecipeApi,)):
119 p(1, 'behaves like %s' % map_to_cool_name(cool_base)) 120 p(1, 'behaves like %s' % map_to_cool_name(cool_base))
120 121
121 if mod.API.__doc__: 122 if mod.API.__doc__:
122 for line in trim_doc(mod.API.__doc__): 123 for line in trim_doc(mod.API.__doc__):
123 p(2, '"', line) 124 p(2, '"', line)
124 125
125 for fn_name, obj in member_iter(subinst): 126 for fn_name, obj in member_iter(subinst):
126 if fn_name in base_fns: 127 if fn_name in base_fns:
127 continue 128 continue
128 pmethod(1, fn_name, obj) 129 pmethod(1, fn_name, obj)
OLDNEW
« no previous file with comments | « recipe_engine/config_types.py ('k') | recipe_engine/loader.py » ('j') | recipe_engine/package.py » ('J')

Powered by Google App Engine
This is Rietveld 408576698