| 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 61 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 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] = '"' + str(variables[v]) + '"' | 76 vars_dict[v] = '"' + str(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 # Some GYP variables have hyphens, which we don't support. |
| 83 key = tokens[0].replace("-", "_") |
| 82 if len(tokens) == 2: | 84 if len(tokens) == 2: |
| 83 # Escape $ characters which have special meaning to GN. | 85 # Escape $ characters which have special meaning to GN. |
| 84 vars_dict[tokens[0]] = '"' + tokens[1].replace("$", "\\$") + '"' | 86 vars_dict[key] = '"' + tokens[1].replace("$", "\\$") + '"' |
| 85 else: | 87 else: |
| 86 # No value supplied, treat it as a boolean and set it. | 88 # No value supplied, treat it as a boolean and set it. |
| 87 vars_dict[tokens[0]] = 'true' | 89 vars_dict[key] = 'true' |
| 88 | 90 |
| 89 vars_string = '' | 91 vars_string = '' |
| 90 for v in vars_dict: | 92 for v in vars_dict: |
| 91 vars_string = vars_string + v + '=' + vars_dict[v] + ' ' | 93 vars_string = vars_string + v + '=' + vars_dict[v] + ' ' |
| 92 return vars_string.strip() # Remove trailing space. | 94 return vars_string.strip() # Remove trailing space. |
| 93 | 95 |
| 94 | 96 |
| 95 def additional_include_files(supplemental_files, args=[]): | 97 def additional_include_files(supplemental_files, args=[]): |
| 96 """ | 98 """ |
| 97 Returns a list of additional (.gypi) files to include, without duplicating | 99 Returns a list of additional (.gypi) files to include, without duplicating |
| (...skipping 166 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 264 # to enfore syntax checking. | 266 # to enfore syntax checking. |
| 265 syntax_check = os.environ.get('CHROMIUM_GYP_SYNTAX_CHECK') | 267 syntax_check = os.environ.get('CHROMIUM_GYP_SYNTAX_CHECK') |
| 266 if syntax_check and int(syntax_check): | 268 if syntax_check and int(syntax_check): |
| 267 args.append('--check') | 269 args.append('--check') |
| 268 | 270 |
| 269 print 'Updating projects from gyp files...' | 271 print 'Updating projects from gyp files...' |
| 270 sys.stdout.flush() | 272 sys.stdout.flush() |
| 271 | 273 |
| 272 # Off we go... | 274 # Off we go... |
| 273 sys.exit(gyp.main(args)) | 275 sys.exit(gyp.main(args)) |
| OLD | NEW |