| 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)] = '"' + \ |
| 88 str(variables[v]).replace("$", "\\$") + '"' |
| 88 | 89 |
| 89 env_string = os.environ.get('GYP_DEFINES', '') | 90 env_string = os.environ.get('GYP_DEFINES', '') |
| 90 items = shlex.split(env_string) | 91 items = shlex.split(env_string) |
| 91 for item in items: | 92 for item in items: |
| 92 tokens = item.split('=', 1) | 93 tokens = item.split('=', 1) |
| 93 # Some GYP variables have hyphens, which we don't support. | 94 # Some GYP variables have hyphens, which we don't support. |
| 94 key = FormatKeyForGN(tokens[0]) | 95 key = FormatKeyForGN(tokens[0]) |
| 95 if len(tokens) == 2: | 96 if len(tokens) == 2: |
| 96 # Escape $ characters which have special meaning to GN. | 97 # Escape $ characters which have special meaning to GN. |
| 97 vars_dict[key] = '"' + tokens[1].replace("$", "\\$") + '"' | 98 vars_dict[key] = '"' + tokens[1].replace("$", "\\$") + '"' |
| (...skipping 179 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 277 # to enfore syntax checking. | 278 # to enfore syntax checking. |
| 278 syntax_check = os.environ.get('CHROMIUM_GYP_SYNTAX_CHECK') | 279 syntax_check = os.environ.get('CHROMIUM_GYP_SYNTAX_CHECK') |
| 279 if syntax_check and int(syntax_check): | 280 if syntax_check and int(syntax_check): |
| 280 args.append('--check') | 281 args.append('--check') |
| 281 | 282 |
| 282 print 'Updating projects from gyp files...' | 283 print 'Updating projects from gyp files...' |
| 283 sys.stdout.flush() | 284 sys.stdout.flush() |
| 284 | 285 |
| 285 # Off we go... | 286 # Off we go... |
| 286 sys.exit(gyp.main(args)) | 287 sys.exit(gyp.main(args)) |
| OLD | NEW |