OLD | NEW |
---|---|
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 302 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
313 env_name='GYP_GENERATOR_OUTPUT', | 313 env_name='GYP_GENERATOR_OUTPUT', |
314 help='puts generated build files under DIR') | 314 help='puts generated build files under DIR') |
315 parser.add_option('--ignore-environment', dest='use_environment', | 315 parser.add_option('--ignore-environment', dest='use_environment', |
316 action='store_false', default=True, regenerate=False, | 316 action='store_false', default=True, regenerate=False, |
317 help='do not read options from environment variables') | 317 help='do not read options from environment variables') |
318 parser.add_option('--check', dest='check', action='store_true', | 318 parser.add_option('--check', dest='check', action='store_true', |
319 help='check format of gyp files') | 319 help='check format of gyp files') |
320 parser.add_option('--toplevel-dir', dest='toplevel_dir', action='store', | 320 parser.add_option('--toplevel-dir', dest='toplevel_dir', action='store', |
321 default=None, metavar='DIR', type='path', | 321 default=None, metavar='DIR', type='path', |
322 help='directory to use as the root of the source tree') | 322 help='directory to use as the root of the source tree') |
323 parser.add_option('--host-flavor', dest='host_flavor', action='store', | |
Mark Mentovai
2012/08/22 13:21:14
This is a “host OS.” I have no idea what a “flavor
| |
324 env_name='GYP_HOST_FLAVOR', regenerate=False, | |
325 help='overrides host OS flavor used to crosscompile') | |
323 # --no-circular-check disables the check for circular relationships between | 326 # --no-circular-check disables the check for circular relationships between |
324 # .gyp files. These relationships should not exist, but they've only been | 327 # .gyp files. These relationships should not exist, but they've only been |
325 # observed to be harmful with the Xcode generator. Chromium's .gyp files | 328 # observed to be harmful with the Xcode generator. Chromium's .gyp files |
326 # currently have some circular relationships on non-Mac platforms, so this | 329 # currently have some circular relationships on non-Mac platforms, so this |
327 # option allows the strict behavior to be used on Macs and the lenient | 330 # option allows the strict behavior to be used on Macs and the lenient |
328 # behavior to be used elsewhere. | 331 # behavior to be used elsewhere. |
329 # TODO(mark): Remove this option when http://crbug.com/35878 is fixed. | 332 # TODO(mark): Remove this option when http://crbug.com/35878 is fixed. |
330 parser.add_option('--no-circular-check', dest='circular_check', | 333 parser.add_option('--no-circular-check', dest='circular_check', |
331 action='store_false', default=True, regenerate=False, | 334 action='store_false', default=True, regenerate=False, |
332 help="don't check for circular relationships between files") | 335 help="don't check for circular relationships between files") |
(...skipping 11 matching lines...) Expand all Loading... | |
344 if not os.path.exists(home_dot_gyp): | 347 if not os.path.exists(home_dot_gyp): |
345 home_dot_gyp = None | 348 home_dot_gyp = None |
346 else: | 349 else: |
347 break | 350 break |
348 | 351 |
349 # TODO(thomasvl): add support for ~/.gyp/defaults | 352 # TODO(thomasvl): add support for ~/.gyp/defaults |
350 | 353 |
351 options, build_files_arg = parser.parse_args(args) | 354 options, build_files_arg = parser.parse_args(args) |
352 build_files = build_files_arg | 355 build_files = build_files_arg |
353 | 356 |
357 if not options.host_flavor and options.use_environment: | |
358 h_f = os.environ.get('GYP_HOST_FLAVOR') | |
359 if h_f: | |
360 options.host_flavor = h_f | |
361 | |
354 if not options.formats: | 362 if not options.formats: |
355 # If no format was given on the command line, then check the env variable. | 363 # If no format was given on the command line, then check the env variable. |
356 generate_formats = [] | 364 generate_formats = [] |
357 if options.use_environment: | 365 if options.use_environment: |
358 generate_formats = os.environ.get('GYP_GENERATORS', []) | 366 generate_formats = os.environ.get('GYP_GENERATORS', []) |
359 if generate_formats: | 367 if generate_formats: |
360 generate_formats = re.split('[\s,]', generate_formats) | 368 generate_formats = re.split('[\s,]', generate_formats) |
361 if generate_formats: | 369 if generate_formats: |
362 options.formats = generate_formats | 370 options.formats = generate_formats |
363 else: | 371 else: |
(...skipping 144 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
508 | 516 |
509 def main(args): | 517 def main(args): |
510 try: | 518 try: |
511 return gyp_main(args) | 519 return gyp_main(args) |
512 except GypError, e: | 520 except GypError, e: |
513 sys.stderr.write("gyp: %s\n" % e) | 521 sys.stderr.write("gyp: %s\n" % e) |
514 return 1 | 522 return 1 |
515 | 523 |
516 if __name__ == '__main__': | 524 if __name__ == '__main__': |
517 sys.exit(main(sys.argv[1:])) | 525 sys.exit(main(sys.argv[1:])) |
OLD | NEW |