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 sys | 13 import sys |
14 | 14 |
15 print 'Updating projects from gyp files...' | 15 script_dir = os.path.dirname(__file__) |
16 sys.stdout.flush() | 16 chrome_src = os.path.normpath(os.path.join(script_dir, os.pardir)) |
17 | 17 |
18 chrome_src = os.path.join(os.path.dirname(sys.argv[0]), os.pardir) | 18 sys.path.append(os.path.join(chrome_src, 'tools', 'gyp', 'pylib')) |
19 | 19 import gyp |
20 try: | |
21 import gyp | |
22 except ImportError, e: | |
23 sys.path.append(os.path.join(chrome_src, 'tools', 'gyp', 'pylib')) | |
24 import gyp | |
25 | 20 |
26 if __name__ == '__main__': | 21 if __name__ == '__main__': |
27 args = sys.argv[1:] | 22 args = sys.argv[1:] |
28 | 23 |
29 # If we didn't get a file, check an env var, and then fall back to | 24 # If we didn't get a file, check an env var, and then fall back to |
30 # assuming 'src/build/all.gyp'. This can't have any backslashes as path | 25 # assuming 'all.gyp' from the same directory as the script. |
31 # separators even on Windows due to the use of shlex.split. | 26 gyp_file = os.environ.get('CHROMIUM_GYP_FILE') |
32 default_gyp_file = 'src/build/all.gyp' | 27 if gyp_file: |
33 if len(args) == 0: | 28 # Note that CHROMIUM_GYP_FILE values can't have backslashes as |
34 args += shlex.split(os.environ.get('CHROMIUM_GYP_FILE', | 29 # path separators even on Windows due to the use of shlex.split(). |
35 default_gyp_file)) | 30 args.extend(shlex.split(gyp_file)) |
| 31 else: |
| 32 args.append(os.path.join(script_dir, 'all.gyp')) |
36 | 33 |
37 # Always include common.gypi | 34 # Always include common.gypi |
38 args += ['-I', os.path.join(chrome_src, 'build', 'common.gypi')] | 35 args += ['-I', os.path.join(script_dir, 'common.gypi')] |
39 | 36 |
40 # Optionally add supplemental .gypi files if present. | 37 # Optionally add supplemental .gypi files if present. |
41 supplements = glob.glob(os.path.join(chrome_src, '*', 'supplement.gypi')) | 38 supplements = glob.glob(os.path.join(chrome_src, '*', 'supplement.gypi')) |
42 for supplement in supplements: | 39 for supplement in supplements: |
43 args += ['-I', supplement] | 40 args += ['-I', supplement] |
44 | 41 |
| 42 print 'Updating projects from gyp files...' |
| 43 sys.stdout.flush() |
| 44 |
45 # Off we go... | 45 # Off we go... |
46 sys.exit(gyp.main(args)) | 46 sys.exit(gyp.main(args)) |
OLD | NEW |