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

Side by Side Diff: pylib/gyp/__init__.py

Issue 115922: Add a generic way for generator info to get passed to input to affect process... (Closed) Base URL: http://gyp.googlecode.com/svn/trunk/
Patch Set: '' Created 11 years, 6 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
« no previous file with comments | « no previous file | pylib/gyp/generator/msvs.py » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 #!/usr/bin/python 1 #!/usr/bin/python
2 2
3 import gyp.input 3 import gyp.input
4 import optparse 4 import optparse
5 import os.path 5 import os.path
6 import shlex 6 import shlex
7 import sys 7 import sys
8 8
9 9
10 def FindBuildFiles(): 10 def FindBuildFiles():
(...skipping 132 matching lines...) Expand 10 before | Expand all | Expand 10 after
143 # Default variables provided by this program and its modules should be 143 # Default variables provided by this program and its modules should be
144 # named WITH_CAPITAL_LETTERS to provide a distinct "best practice" namespace , 144 # named WITH_CAPITAL_LETTERS to provide a distinct "best practice" namespace ,
145 # avoiding collisions with user and automatic variables. 145 # avoiding collisions with user and automatic variables.
146 default_variables['GENERATOR'] = format 146 default_variables['GENERATOR'] = format
147 147
148 generator_name = 'gyp.generator.' + format 148 generator_name = 'gyp.generator.' + format
149 # These parameters are passed in order (as opposed to by key) 149 # These parameters are passed in order (as opposed to by key)
150 # because ActivePython cannot handle key parameters to __import__. 150 # because ActivePython cannot handle key parameters to __import__.
151 generator = __import__(generator_name, globals(), locals(), generator_name) 151 generator = __import__(generator_name, globals(), locals(), generator_name)
152 default_variables.update(generator.generator_default_variables) 152 default_variables.update(generator.generator_default_variables)
153
154 # Fetch the generator specific info that gets fed to input, we use getattr
155 # so we can default things and the generators only have to provide what
156 # they need.
157 generator_input_info = {
158 'generator_handles_variants':
159 getattr(generator, 'generator_handles_variants', False),
160 'non_configuration_keys':
161 getattr(generator, 'generator_additional_non_configuration_keys', []),
162 'path_sections':
163 getattr(generator, 'generator_additional_path_sections', []),
164 }
153 165
154 # Process the input specific to this generator. 166 # Process the input specific to this generator.
155 [flat_list, targets, data] = gyp.input.Load(build_files, default_variables, 167 [flat_list, targets, data] = gyp.input.Load(build_files, default_variables,
156 includes[:], options.depth) 168 includes[:], options.depth,
169 generator_input_info)
157 170
158 params = {'options': options, 171 params = {'options': options,
159 'build_files': build_files, 172 'build_files': build_files,
160 'generator_flags': generator_flags} 173 'generator_flags': generator_flags}
161 174
162 # TODO(mark): Pass |data| for now because the generator needs a list of 175 # TODO(mark): Pass |data| for now because the generator needs a list of
163 # build files that came in. In the future, maybe it should just accept 176 # build files that came in. In the future, maybe it should just accept
164 # a list, and not the whole data dict. 177 # a list, and not the whole data dict.
165 # NOTE: flat_list is the flattened dependency graph specifying the order 178 # NOTE: flat_list is the flattened dependency graph specifying the order
166 # that targets may be built. Build systems that operate serially or that 179 # that targets may be built. Build systems that operate serially or that
167 # need to have dependencies defined before dependents reference them should 180 # need to have dependencies defined before dependents reference them should
168 # generate targets in the order specified in flat_list. 181 # generate targets in the order specified in flat_list.
169 generator.GenerateOutput(flat_list, targets, data, params) 182 generator.GenerateOutput(flat_list, targets, data, params)
170 183
171 # Done 184 # Done
172 return 0 185 return 0
173 186
174 187
175 if __name__ == '__main__': 188 if __name__ == '__main__':
176 sys.exit(main(sys.argv[1:])) 189 sys.exit(main(sys.argv[1:]))
OLDNEW
« no previous file with comments | « no previous file | pylib/gyp/generator/msvs.py » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698