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 52 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
63 if '-' in format: | 63 if '-' in format: |
64 format, params['flavor'] = format.split('-', 1) | 64 format, params['flavor'] = format.split('-', 1) |
65 | 65 |
66 default_variables = copy.copy(default_variables) | 66 default_variables = copy.copy(default_variables) |
67 | 67 |
68 # Default variables provided by this program and its modules should be | 68 # Default variables provided by this program and its modules should be |
69 # named WITH_CAPITAL_LETTERS to provide a distinct "best practice" namespace, | 69 # named WITH_CAPITAL_LETTERS to provide a distinct "best practice" namespace, |
70 # avoiding collisions with user and automatic variables. | 70 # avoiding collisions with user and automatic variables. |
71 default_variables['GENERATOR'] = format | 71 default_variables['GENERATOR'] = format |
72 | 72 |
73 # Provide a PYTHON value to run sub-commands with the same python | |
74 default_variables['PYTHON'] = sys.executable | |
Mark Mentovai
2013/03/04 21:24:53
default_variables isn’t right. Which commands are
Evan Martin
2013/03/05 17:05:49
(I glanced at the Mozilla patch that prompted this
tony
2013/03/05 22:33:24
Is it possible to use <!@pymod_do_main(foo <@(INPU
| |
75 | |
73 # Format can be a custom python file, or by default the name of a module | 76 # Format can be a custom python file, or by default the name of a module |
74 # within gyp.generator. | 77 # within gyp.generator. |
75 if format.endswith('.py'): | 78 if format.endswith('.py'): |
76 generator_name = os.path.splitext(format)[0] | 79 generator_name = os.path.splitext(format)[0] |
77 path, generator_name = os.path.split(generator_name) | 80 path, generator_name = os.path.split(generator_name) |
78 | 81 |
79 # Make sure the path to the custom generator is in sys.path | 82 # 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 | 83 # 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 | 84 # to each generator that is used in sys.path is likely harmless and |
82 # arguably a good idea. | 85 # arguably a good idea. |
(...skipping 440 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
523 | 526 |
524 def main(args): | 527 def main(args): |
525 try: | 528 try: |
526 return gyp_main(args) | 529 return gyp_main(args) |
527 except GypError, e: | 530 except GypError, e: |
528 sys.stderr.write("gyp: %s\n" % e) | 531 sys.stderr.write("gyp: %s\n" % e) |
529 return 1 | 532 return 1 |
530 | 533 |
531 if __name__ == '__main__': | 534 if __name__ == '__main__': |
532 sys.exit(main(sys.argv[1:])) | 535 sys.exit(main(sys.argv[1:])) |
OLD | NEW |