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

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

Issue 12063003: Added new command line option: --allow-duplicate-basenames (Closed) Base URL: http://gyp.googlecode.com/svn/trunk/
Patch Set: Created 7 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 | Annotate | Revision Log
« no previous file with comments | « no previous file | pylib/gyp/input.py » ('j') | pylib/gyp/input.py » ('J')
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 #!/usr/bin/env python 1 #!/usr/bin/env python
2 2
3 # Copyright (c) 2012 Google Inc. All rights reserved. 3 # Copyright (c) 2012 Google Inc. All rights reserved.
4 # Use of this source code is governed by a BSD-style license that can be 4 # Use of this source code is governed by a BSD-style license that can be
5 # found in the LICENSE file. 5 # found in the LICENSE file.
6 6
7 import copy 7 import copy
8 import gyp.input 8 import gyp.input
9 import optparse 9 import optparse
10 import os.path 10 import os.path
(...skipping 29 matching lines...) Expand all
40 files = os.listdir(os.getcwd()) 40 files = os.listdir(os.getcwd())
41 build_files = [] 41 build_files = []
42 for file in files: 42 for file in files:
43 if file.endswith(extension): 43 if file.endswith(extension):
44 build_files.append(file) 44 build_files.append(file)
45 return build_files 45 return build_files
46 46
47 47
48 def Load(build_files, format, default_variables={}, 48 def Load(build_files, format, default_variables={},
49 includes=[], depth='.', params=None, check=False, 49 includes=[], depth='.', params=None, check=False,
50 circular_check=True): 50 circular_check=True, allow_duplicates=False):
51 """ 51 """
52 Loads one or more specified build files. 52 Loads one or more specified build files.
53 default_variables and includes will be copied before use. 53 default_variables and includes will be copied before use.
54 Returns the generator for the specified format and the 54 Returns the generator for the specified format and the
55 data returned by loading the specified build files. 55 data returned by loading the specified build files.
56 """ 56 """
57 if params is None: 57 if params is None:
58 params = {} 58 params = {}
59 59
60 flavor = None 60 flavor = None
(...skipping 58 matching lines...) Expand 10 before | Expand all | Expand 10 after
119 'generator_wants_static_library_dependencies_adjusted': 119 'generator_wants_static_library_dependencies_adjusted':
120 getattr(generator, 120 getattr(generator,
121 'generator_wants_static_library_dependencies_adjusted', True), 121 'generator_wants_static_library_dependencies_adjusted', True),
122 'generator_wants_sorted_dependencies': 122 'generator_wants_sorted_dependencies':
123 getattr(generator, 'generator_wants_sorted_dependencies', False), 123 getattr(generator, 'generator_wants_sorted_dependencies', False),
124 } 124 }
125 125
126 # Process the input specific to this generator. 126 # Process the input specific to this generator.
127 result = gyp.input.Load(build_files, default_variables, includes[:], 127 result = gyp.input.Load(build_files, default_variables, includes[:],
128 depth, generator_input_info, check, circular_check, 128 depth, generator_input_info, check, circular_check,
129 params['parallel']) 129 allow_duplicates, params['parallel'])
130 return [generator] + result 130 return [generator] + result
131 131
132 def NameValueListToDict(name_value_list): 132 def NameValueListToDict(name_value_list):
133 """ 133 """
134 Takes an array of strings of the form 'NAME=VALUE' and creates a dictionary 134 Takes an array of strings of the form 'NAME=VALUE' and creates a dictionary
135 of the pairs. If a string is simply NAME, then the value in the dictionary 135 of the pairs. If a string is simply NAME, then the value in the dictionary
136 is set to True. If VALUE can be converted to an integer, it is. 136 is set to True. If VALUE can be converted to an integer, it is.
137 """ 137 """
138 result = { } 138 result = { }
139 for item in name_value_list: 139 for item in name_value_list:
(...skipping 184 matching lines...) Expand 10 before | Expand all | Expand 10 after
324 # --no-circular-check disables the check for circular relationships between 324 # --no-circular-check disables the check for circular relationships between
325 # .gyp files. These relationships should not exist, but they've only been 325 # .gyp files. These relationships should not exist, but they've only been
326 # observed to be harmful with the Xcode generator. Chromium's .gyp files 326 # observed to be harmful with the Xcode generator. Chromium's .gyp files
327 # currently have some circular relationships on non-Mac platforms, so this 327 # currently have some circular relationships on non-Mac platforms, so this
328 # option allows the strict behavior to be used on Macs and the lenient 328 # option allows the strict behavior to be used on Macs and the lenient
329 # behavior to be used elsewhere. 329 # behavior to be used elsewhere.
330 # TODO(mark): Remove this option when http://crbug.com/35878 is fixed. 330 # TODO(mark): Remove this option when http://crbug.com/35878 is fixed.
331 parser.add_option('--no-circular-check', dest='circular_check', 331 parser.add_option('--no-circular-check', dest='circular_check',
332 action='store_false', default=True, regenerate=False, 332 action='store_false', default=True, regenerate=False,
333 help="don't check for circular relationships between files") 333 help="don't check for circular relationships between files")
334 parser.add_option('--allow-duplicate-basenames', dest='allow_duplicates',
335 default=False, help='Allow duplicate file basenames ' +
336 '(may not work for MSVC08)')
334 337
335 # We read a few things from ~/.gyp, so set up a var for that. 338 # We read a few things from ~/.gyp, so set up a var for that.
336 home_vars = ['HOME'] 339 home_vars = ['HOME']
337 if sys.platform in ('cygwin', 'win32'): 340 if sys.platform in ('cygwin', 'win32'):
338 home_vars.append('USERPROFILE') 341 home_vars.append('USERPROFILE')
339 home = None 342 home = None
340 home_dot_gyp = None 343 home_dot_gyp = None
341 for home_var in home_vars: 344 for home_var in home_vars:
342 home = os.getenv(home_var) 345 home = os.getenv(home_var)
343 if home != None: 346 if home != None:
(...skipping 142 matching lines...) Expand 10 before | Expand all | Expand 10 after
486 params = {'options': options, 489 params = {'options': options,
487 'build_files': build_files, 490 'build_files': build_files,
488 'generator_flags': generator_flags, 491 'generator_flags': generator_flags,
489 'cwd': os.getcwd(), 492 'cwd': os.getcwd(),
490 'build_files_arg': build_files_arg, 493 'build_files_arg': build_files_arg,
491 'gyp_binary': sys.argv[0], 494 'gyp_binary': sys.argv[0],
492 'home_dot_gyp': home_dot_gyp, 495 'home_dot_gyp': home_dot_gyp,
493 'parallel': options.parallel} 496 'parallel': options.parallel}
494 497
495 # Start with the default variables from the command line. 498 # Start with the default variables from the command line.
496 [generator, flat_list, targets, data] = Load(build_files, format, 499 [generator, flat_list, targets, data] = Load(build_files,
500 format,
497 cmdline_default_variables, 501 cmdline_default_variables,
498 includes, options.depth, 502 includes,
499 params, options.check, 503 options.depth,
500 options.circular_check) 504 params,
505 options.check,
506 options.circular_check,
507 options.allow_duplicates)
501 508
502 # TODO(mark): Pass |data| for now because the generator needs a list of 509 # TODO(mark): Pass |data| for now because the generator needs a list of
503 # build files that came in. In the future, maybe it should just accept 510 # build files that came in. In the future, maybe it should just accept
504 # a list, and not the whole data dict. 511 # a list, and not the whole data dict.
505 # NOTE: flat_list is the flattened dependency graph specifying the order 512 # NOTE: flat_list is the flattened dependency graph specifying the order
506 # that targets may be built. Build systems that operate serially or that 513 # that targets may be built. Build systems that operate serially or that
507 # need to have dependencies defined before dependents reference them should 514 # need to have dependencies defined before dependents reference them should
508 # generate targets in the order specified in flat_list. 515 # generate targets in the order specified in flat_list.
509 generator.GenerateOutput(flat_list, targets, data, params) 516 generator.GenerateOutput(flat_list, targets, data, params)
510 517
(...skipping 10 matching lines...) Expand all
521 528
522 def main(args): 529 def main(args):
523 try: 530 try:
524 return gyp_main(args) 531 return gyp_main(args)
525 except GypError, e: 532 except GypError, e:
526 sys.stderr.write("gyp: %s\n" % e) 533 sys.stderr.write("gyp: %s\n" % e)
527 return 1 534 return 1
528 535
529 if __name__ == '__main__': 536 if __name__ == '__main__':
530 sys.exit(main(sys.argv[1:])) 537 sys.exit(main(sys.argv[1:]))
OLDNEW
« no previous file with comments | « no previous file | pylib/gyp/input.py » ('j') | pylib/gyp/input.py » ('J')

Powered by Google App Engine
This is Rietveld 408576698