OLD | NEW |
1 #!/usr/bin/env python | 1 #!/usr/bin/env python |
2 | 2 |
3 # Copyright (c) 2012 The Chromium Authors. All rights reserved. | 3 # Copyright (c) 2012 The Chromium Authors. 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 # This script is wrapper for Chromium that adds some support for how GYP | 7 # This script is wrapper for Chromium that adds some support for how GYP |
8 # is invoked by Chromium beyond what can be done in the gclient hooks. | 8 # is invoked by Chromium beyond what can be done in the gclient hooks. |
9 | 9 |
10 import glob | 10 import glob |
(...skipping 103 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
114 supp_items += [(FormatKeyForGN(v), str(variables[v]))] | 114 supp_items += [(FormatKeyForGN(v), str(variables[v]))] |
115 | 115 |
116 # GYP defines from the environment. | 116 # GYP defines from the environment. |
117 env_items = ProcessGypDefinesItems( | 117 env_items = ProcessGypDefinesItems( |
118 shlex.split(os.environ.get('GYP_DEFINES', ''))) | 118 shlex.split(os.environ.get('GYP_DEFINES', ''))) |
119 | 119 |
120 # GYP defines from the command line. We can't use optparse since we want | 120 # GYP defines from the command line. We can't use optparse since we want |
121 # to ignore all arguments other than "-D". | 121 # to ignore all arguments other than "-D". |
122 cmdline_input_items = [] | 122 cmdline_input_items = [] |
123 for i in range(len(sys.argv))[1:]: | 123 for i in range(len(sys.argv))[1:]: |
124 if sys.argv[i] == '-D' and i + 1 < len(sys.argv): | 124 if sys.argv[i].startswith('-D'): |
125 cmdline_input_items += [sys.argv[i + 1]] | 125 if sys.argv[i] == '-D' and i + 1 < len(sys.argv): |
| 126 cmdline_input_items += [sys.argv[i + 1]] |
| 127 elif len(sys.argv[i]) > 2: |
| 128 cmdline_input_items += [sys.argv[i][2:]] |
126 cmdline_items = ProcessGypDefinesItems(cmdline_input_items) | 129 cmdline_items = ProcessGypDefinesItems(cmdline_input_items) |
127 | 130 |
128 return dict(supp_items + env_items + cmdline_items) | 131 return dict(supp_items + env_items + cmdline_items) |
129 | 132 |
130 def GetOutputDirectory(): | 133 def GetOutputDirectory(): |
131 """Returns the output directory that GYP will use.""" | 134 """Returns the output directory that GYP will use.""" |
132 # GYP generator flags from the command line. We can't use optparse since we | 135 # GYP generator flags from the command line. We can't use optparse since we |
133 # want to ignore all arguments other than "-G". | 136 # want to ignore all arguments other than "-G". |
134 needle = '-Goutput_dir=' | 137 needle = '-Goutput_dir=' |
135 cmdline_input_items = [] | 138 cmdline_input_items = [] |
(...skipping 287 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
423 args.extend( | 426 args.extend( |
424 ['-I' + i for i in additional_include_files(supplemental_includes, args)]) | 427 ['-I' + i for i in additional_include_files(supplemental_includes, args)]) |
425 | 428 |
426 args.extend(['-D', 'gyp_output_dir=' + GetOutputDirectory()]) | 429 args.extend(['-D', 'gyp_output_dir=' + GetOutputDirectory()]) |
427 | 430 |
428 print 'Updating projects from gyp files...' | 431 print 'Updating projects from gyp files...' |
429 sys.stdout.flush() | 432 sys.stdout.flush() |
430 | 433 |
431 # Off we go... | 434 # Off we go... |
432 sys.exit(gyp.main(args)) | 435 sys.exit(gyp.main(args)) |
OLD | NEW |