Chromium Code Reviews| 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 44 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 55 default_variables and includes will be copied before use. | 55 default_variables and includes will be copied before use. |
| 56 Returns the generator for the specified format and the | 56 Returns the generator for the specified format and the |
| 57 data returned by loading the specified build files. | 57 data returned by loading the specified build files. |
| 58 """ | 58 """ |
| 59 if params is None: | 59 if params is None: |
| 60 params = {} | 60 params = {} |
| 61 | 61 |
| 62 flavor = None | 62 flavor = None |
| 63 if '-' in format: | 63 if '-' in format: |
| 64 format, params['flavor'] = format.split('-', 1) | 64 format, params['flavor'] = format.split('-', 1) |
| 65 flavor = params['flavor'] | |
|
justincohen
2015/03/16 15:12:24
is it necessary to pull this out into a new variab
sdefresne
2015/03/16 15:47:05
The variable already existed (see above) but was n
sdefresne
2015/03/16 15:49:00
Done.
| |
| 65 | 66 |
| 66 default_variables = copy.copy(default_variables) | 67 default_variables = copy.copy(default_variables) |
| 67 | 68 |
| 68 # Default variables provided by this program and its modules should be | 69 # Default variables provided by this program and its modules should be |
| 69 # named WITH_CAPITAL_LETTERS to provide a distinct "best practice" namespace, | 70 # named WITH_CAPITAL_LETTERS to provide a distinct "best practice" namespace, |
| 70 # avoiding collisions with user and automatic variables. | 71 # avoiding collisions with user and automatic variables. |
| 71 default_variables['GENERATOR'] = format | 72 default_variables['GENERATOR'] = format |
| 73 default_variables['GENERATOR_FLAVOR'] = flavor or "" | |
| 72 | 74 |
| 73 # Format can be a custom python file, or by default the name of a module | 75 # Format can be a custom python file, or by default the name of a module |
| 74 # within gyp.generator. | 76 # within gyp.generator. |
| 75 if format.endswith('.py'): | 77 if format.endswith('.py'): |
| 76 generator_name = os.path.splitext(format)[0] | 78 generator_name = os.path.splitext(format)[0] |
| 77 path, generator_name = os.path.split(generator_name) | 79 path, generator_name = os.path.split(generator_name) |
| 78 | 80 |
| 79 # Make sure the path to the custom generator is in sys.path | 81 # Make sure the path to the custom generator is in sys.path |
| 80 # Don't worry about removing it once we are done. Keeping the path | 82 # Don't worry about removing it once we are done. Keeping the path |
| 81 # to each generator that is used in sys.path is likely harmless and | 83 # to each generator that is used in sys.path is likely harmless and |
| (...skipping 445 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 527 except GypError, e: | 529 except GypError, e: |
| 528 sys.stderr.write("gyp: %s\n" % e) | 530 sys.stderr.write("gyp: %s\n" % e) |
| 529 return 1 | 531 return 1 |
| 530 | 532 |
| 531 # NOTE: setuptools generated console_scripts calls function with no arguments | 533 # NOTE: setuptools generated console_scripts calls function with no arguments |
| 532 def script_main(): | 534 def script_main(): |
| 533 return main(sys.argv[1:]) | 535 return main(sys.argv[1:]) |
| 534 | 536 |
| 535 if __name__ == '__main__': | 537 if __name__ == '__main__': |
| 536 sys.exit(script_main()) | 538 sys.exit(script_main()) |
| OLD | NEW |