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

Side by Side Diff: scripts/tools/show_me_the_modules.py

Issue 1151423002: Move recipe engine to third_party/recipe_engine. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/tools/build
Patch Set: Copyright notices Created 5 years, 7 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 | Annotate | Revision Log
OLDNEW
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 slave import annotated_run 17 from recipe_engine import annotated_run
18 from slave import recipe_api 18 from recipe_engine import recipe_api
19 from slave import recipe_loader 19 from recipe_engine import recipe_loader
20 from slave import recipe_util 20 from recipe_engine import recipe_util
21
22 from slave import recipe_universe
21 23
22 def trim_doc(docstring): 24 def trim_doc(docstring):
23 """From PEP 257""" 25 """From PEP 257"""
24 if not docstring: 26 if not docstring:
25 return '' 27 return ''
26 # Convert tabs to spaces (following the normal Python rules) 28 # Convert tabs to spaces (following the normal Python rules)
27 # and split into a list of lines: 29 # and split into a list of lines:
28 lines = docstring.expandtabs().splitlines() 30 lines = docstring.expandtabs().splitlines()
29 # Determine minimum indentation (first line doesn't count): 31 # Determine minimum indentation (first line doesn't count):
30 indent = sys.maxint 32 indent = sys.maxint
(...skipping 47 matching lines...) Expand 10 before | Expand all | Expand 10 after
78 p(0, '--', lines[0]) 80 p(0, '--', lines[0])
79 else: 81 else:
80 p(0) 82 p(0)
81 83
82 def main(): 84 def main():
83 common_methods = set(k for k, v in member_iter(recipe_api.RecipeApi)) 85 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]) 86 p(0, 'Common Methods -- %s' % os.path.splitext(recipe_api.__file__)[0])
85 for method in sorted(common_methods): 87 for method in sorted(common_methods):
86 pmethod(1, method, getattr(recipe_api.RecipeApi, method)) 88 pmethod(1, method, getattr(recipe_api.RecipeApi, method))
87 89
88 universe = recipe_loader.RecipeUniverse() 90 universe = recipe_universe.get_universe()
89 deps = universe.deps_from_paths( 91 deps = universe.deps_from_paths(
90 { modpath: modpath 92 { modpath: modpath
91 for modpath in recipe_loader.loop_over_recipe_modules() }, 93 for modpath in universe.loop_over_recipe_modules() },
92 base_path=None) 94 base_path=None)
93 95
94 inst = recipe_loader.create_recipe_api( 96 inst = recipe_loader.create_recipe_api(
95 deps, annotated_run.SequentialRecipeEngine(None, {}, None)) 97 deps, annotated_run.SequentialRecipeEngine(None, {}, None))
96 98
97 for mod_name, mod in deps.iteritems(): 99 for mod_name, mod in deps.iteritems():
98 p(0) 100 p(0)
99 p(0, "(%s) -- %s" % (mod_name, mod.__path__[0])) 101 p(0, "(%s) -- %s" % (mod_name, mod.__path__[0]))
100 if mod.LOADED_DEPS: 102 if mod.LOADED_DEPS:
101 p(1, 'DEPS:', list(mod.LOADED_DEPS)) 103 p(1, 'DEPS:', list(mod.LOADED_DEPS))
(...skipping 12 matching lines...) Expand all
114 p(2, '"', line) 116 p(2, '"', line)
115 117
116 for fn_name, obj in member_iter(subinst): 118 for fn_name, obj in member_iter(subinst):
117 if fn_name in base_fns: 119 if fn_name in base_fns:
118 continue 120 continue
119 pmethod(1, fn_name, obj) 121 pmethod(1, fn_name, obj)
120 122
121 123
122 if __name__ == '__main__': 124 if __name__ == '__main__':
123 main() 125 main()
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698