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 66 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
77 | 77 |
78 for supplement in supplemental_files: | 78 for supplement in supplemental_files: |
79 with open(supplement, 'r') as f: | 79 with open(supplement, 'r') as f: |
80 try: | 80 try: |
81 file_data = eval(f.read(), {'__builtins__': None}, None) | 81 file_data = eval(f.read(), {'__builtins__': None}, None) |
82 except SyntaxError, e: | 82 except SyntaxError, e: |
83 e.filename = os.path.abspath(supplement) | 83 e.filename = os.path.abspath(supplement) |
84 raise | 84 raise |
85 variables = file_data.get('variables') | 85 variables = file_data.get('variables') |
86 for v in variables: | 86 for v in variables: |
87 vars_dict[v] = '"' + str(variables[v]) + '"' | 87 vars_dict[FormatKeyForGN(v)] = '"' + str(variables[v]) + '"' |
Nico
2013/12/04 22:02:54
Do you need to escape $ here too?
brettw
2013/12/04 22:07:49
Yeah, I guess so!
| |
88 | 88 |
89 env_string = os.environ.get('GYP_DEFINES', '') | 89 env_string = os.environ.get('GYP_DEFINES', '') |
90 items = shlex.split(env_string) | 90 items = shlex.split(env_string) |
91 for item in items: | 91 for item in items: |
92 tokens = item.split('=', 1) | 92 tokens = item.split('=', 1) |
93 # Some GYP variables have hyphens, which we don't support. | 93 # Some GYP variables have hyphens, which we don't support. |
94 key = FormatKeyForGN(tokens[0]) | 94 key = FormatKeyForGN(tokens[0]) |
95 if len(tokens) == 2: | 95 if len(tokens) == 2: |
96 # Escape $ characters which have special meaning to GN. | 96 # Escape $ characters which have special meaning to GN. |
97 vars_dict[key] = '"' + tokens[1].replace("$", "\\$") + '"' | 97 vars_dict[key] = '"' + tokens[1].replace("$", "\\$") + '"' |
(...skipping 179 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
277 # to enfore syntax checking. | 277 # to enfore syntax checking. |
278 syntax_check = os.environ.get('CHROMIUM_GYP_SYNTAX_CHECK') | 278 syntax_check = os.environ.get('CHROMIUM_GYP_SYNTAX_CHECK') |
279 if syntax_check and int(syntax_check): | 279 if syntax_check and int(syntax_check): |
280 args.append('--check') | 280 args.append('--check') |
281 | 281 |
282 print 'Updating projects from gyp files...' | 282 print 'Updating projects from gyp files...' |
283 sys.stdout.flush() | 283 sys.stdout.flush() |
284 | 284 |
285 # Off we go... | 285 # Off we go... |
286 sys.exit(gyp.main(args)) | 286 sys.exit(gyp.main(args)) |
OLD | NEW |