OLD | NEW |
1 #!/usr/bin/python | 1 #!/usr/bin/python |
2 | 2 |
3 # Copyright (c) 2009 The Chromium Authors. All rights reserved. | 3 # Copyright (c) 2009 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 |
11 import os | 11 import os |
12 import shlex | 12 import shlex |
| 13 import subprocess |
13 import sys | 14 import sys |
14 | 15 |
15 script_dir = os.path.dirname(__file__) | 16 script_dir = os.path.dirname(__file__) |
16 chrome_src = os.path.normpath(os.path.join(script_dir, os.pardir)) | 17 chrome_src = os.path.normpath(os.path.join(script_dir, os.pardir)) |
17 | 18 |
18 sys.path.insert(0, os.path.join(chrome_src, 'tools', 'gyp', 'pylib')) | 19 sys.path.insert(0, os.path.join(chrome_src, 'tools', 'gyp', 'pylib')) |
19 import gyp | 20 import gyp |
20 | 21 |
21 def apply_gyp_environment(file_path=None): | 22 def apply_gyp_environment(file_path=None): |
22 """ | 23 """ |
(...skipping 48 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
71 # Optionally add supplemental .gypi files if present. | 72 # Optionally add supplemental .gypi files if present. |
72 supplements = glob.glob(os.path.join(chrome_src, '*', 'supplement.gypi')) | 73 supplements = glob.glob(os.path.join(chrome_src, '*', 'supplement.gypi')) |
73 for supplement in supplements: | 74 for supplement in supplements: |
74 AddInclude(supplement) | 75 AddInclude(supplement) |
75 | 76 |
76 return result | 77 return result |
77 | 78 |
78 if __name__ == '__main__': | 79 if __name__ == '__main__': |
79 args = sys.argv[1:] | 80 args = sys.argv[1:] |
80 | 81 |
| 82 # Fall back on hermetic python if we happen to get run under cygwin. |
| 83 # TODO(bradnelson): take this out once this issue is fixed: |
| 84 # http://code.google.com/p/gyp/issues/detail?id=177 |
| 85 if sys.platform == 'cygwin': |
| 86 python_dir = os.path.join(chrome_src, 'third_party', 'python_26') |
| 87 env = os.environ.copy() |
| 88 env['PATH'] = python_dir + os.pathsep + env.get('PATH', '') |
| 89 p = subprocess.Popen( |
| 90 [os.path.join(python_dir, 'python.exe')] + sys.argv, |
| 91 env=env, shell=False) |
| 92 p.communicate() |
| 93 sys.exit(p.returncode) |
| 94 |
81 if 'SKIP_CHROMIUM_GYP_ENV' not in os.environ: | 95 if 'SKIP_CHROMIUM_GYP_ENV' not in os.environ: |
82 # Update the environment based on chromium.gyp_env | 96 # Update the environment based on chromium.gyp_env |
83 gyp_env_path = os.path.join(os.path.dirname(chrome_src), 'chromium.gyp_env') | 97 gyp_env_path = os.path.join(os.path.dirname(chrome_src), 'chromium.gyp_env') |
84 apply_gyp_environment(gyp_env_path) | 98 apply_gyp_environment(gyp_env_path) |
85 | 99 |
86 # This could give false positives since it doesn't actually do real option | 100 # This could give false positives since it doesn't actually do real option |
87 # parsing. Oh well. | 101 # parsing. Oh well. |
88 gyp_file_specified = False | 102 gyp_file_specified = False |
89 for arg in args: | 103 for arg in args: |
90 if arg.endswith('.gyp'): | 104 if arg.endswith('.gyp'): |
(...skipping 29 matching lines...) Expand all Loading... |
120 # to enfore syntax checking. | 134 # to enfore syntax checking. |
121 syntax_check = os.environ.get('CHROMIUM_GYP_SYNTAX_CHECK') | 135 syntax_check = os.environ.get('CHROMIUM_GYP_SYNTAX_CHECK') |
122 if syntax_check and int(syntax_check): | 136 if syntax_check and int(syntax_check): |
123 args.append('--check') | 137 args.append('--check') |
124 | 138 |
125 print 'Updating projects from gyp files...' | 139 print 'Updating projects from gyp files...' |
126 sys.stdout.flush() | 140 sys.stdout.flush() |
127 | 141 |
128 # Off we go... | 142 # Off we go... |
129 sys.exit(gyp.main(args)) | 143 sys.exit(gyp.main(args)) |
OLD | NEW |