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. | |
Peter Kasting
2011/02/23 00:04:49
Nit: Do you want to TODO this with the bug about m
| |
83 if sys.platform == 'cygwin': | |
84 python_dir = os.path.join(chrome_src, 'third_party', 'python_26') | |
85 env = os.environ.copy() | |
86 env['PATH'] = python_dir + os.pathsep + env.get('PATH', '') | |
87 p = subprocess.Popen( | |
88 [os.path.join(python_dir, 'python.exe')] + sys.argv, env=env) | |
89 p.communicate() | |
90 sys.exit(p.returncode) | |
91 | |
81 if 'SKIP_CHROMIUM_GYP_ENV' not in os.environ: | 92 if 'SKIP_CHROMIUM_GYP_ENV' not in os.environ: |
82 # Update the environment based on chromium.gyp_env | 93 # Update the environment based on chromium.gyp_env |
83 gyp_env_path = os.path.join(os.path.dirname(chrome_src), 'chromium.gyp_env') | 94 gyp_env_path = os.path.join(os.path.dirname(chrome_src), 'chromium.gyp_env') |
84 apply_gyp_environment(gyp_env_path) | 95 apply_gyp_environment(gyp_env_path) |
85 | 96 |
86 # This could give false positives since it doesn't actually do real option | 97 # This could give false positives since it doesn't actually do real option |
87 # parsing. Oh well. | 98 # parsing. Oh well. |
88 gyp_file_specified = False | 99 gyp_file_specified = False |
89 for arg in args: | 100 for arg in args: |
90 if arg.endswith('.gyp'): | 101 if arg.endswith('.gyp'): |
(...skipping 29 matching lines...) Expand all Loading... | |
120 # to enfore syntax checking. | 131 # to enfore syntax checking. |
121 syntax_check = os.environ.get('CHROMIUM_GYP_SYNTAX_CHECK') | 132 syntax_check = os.environ.get('CHROMIUM_GYP_SYNTAX_CHECK') |
122 if syntax_check and int(syntax_check): | 133 if syntax_check and int(syntax_check): |
123 args.append('--check') | 134 args.append('--check') |
124 | 135 |
125 print 'Updating projects from gyp files...' | 136 print 'Updating projects from gyp files...' |
126 sys.stdout.flush() | 137 sys.stdout.flush() |
127 | 138 |
128 # Off we go... | 139 # Off we go... |
129 sys.exit(gyp.main(args)) | 140 sys.exit(gyp.main(args)) |
OLD | NEW |