| 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 57 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 68 with open(supplement, 'r') as f: | 68 with open(supplement, 'r') as f: |
| 69 try: | 69 try: |
| 70 file_data = eval(f.read(), {'__builtins__': None}, None) | 70 file_data = eval(f.read(), {'__builtins__': None}, None) |
| 71 except SyntaxError, e: | 71 except SyntaxError, e: |
| 72 e.filename = os.path.abspath(supplement) | 72 e.filename = os.path.abspath(supplement) |
| 73 raise | 73 raise |
| 74 variables = file_data.get('variables') | 74 variables = file_data.get('variables') |
| 75 for v in variables: | 75 for v in variables: |
| 76 vars_dict[v] = '"' + variables[v] + '"' | 76 vars_dict[v] = '"' + variables[v] + '"' |
| 77 | 77 |
| 78 env_string = os.environ.get('GYP_DEFINES', []) | 78 env_string = os.environ.get('GYP_DEFINES', '') |
| 79 items = shlex.split(env_string) | 79 items = shlex.split(env_string) |
| 80 for item in items: | 80 for item in items: |
| 81 tokens = item.split('=', 1) | 81 tokens = item.split('=', 1) |
| 82 if len(tokens) == 2: | 82 if len(tokens) == 2: |
| 83 # Escape $ characters which have special meaning to GN. | 83 # Escape $ characters which have special meaning to GN. |
| 84 vars_dict[tokens[0]] = '"' + tokens[1].replace("$", "\\$") + '"' | 84 vars_dict[tokens[0]] = '"' + tokens[1].replace("$", "\\$") + '"' |
| 85 else: | 85 else: |
| 86 # No value supplied, treat it as a boolean and set it. | 86 # No value supplied, treat it as a boolean and set it. |
| 87 vars_dict[tokens[0]] = 'true' | 87 vars_dict[tokens[0]] = 'true' |
| 88 | 88 |
| (...skipping 176 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 265 # to enfore syntax checking. | 265 # to enfore syntax checking. |
| 266 syntax_check = os.environ.get('CHROMIUM_GYP_SYNTAX_CHECK') | 266 syntax_check = os.environ.get('CHROMIUM_GYP_SYNTAX_CHECK') |
| 267 if syntax_check and int(syntax_check): | 267 if syntax_check and int(syntax_check): |
| 268 args.append('--check') | 268 args.append('--check') |
| 269 | 269 |
| 270 print 'Updating projects from gyp files...' | 270 print 'Updating projects from gyp files...' |
| 271 sys.stdout.flush() | 271 sys.stdout.flush() |
| 272 | 272 |
| 273 # Off we go... | 273 # Off we go... |
| 274 sys.exit(gyp.main(args)) | 274 sys.exit(gyp.main(args)) |
| OLD | NEW |