| OLD | NEW |
| 1 #!/usr/bin/python | 1 #!/usr/bin/python |
| 2 | 2 |
| 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 |
| 5 # found in the LICENSE file. |
| 6 |
| 3 # 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 |
| 4 # is invoked by Chromium beyond what can be done it the gclient hooks. | 8 # is invoked by Chromium beyond what can be done in the gclient hooks. |
| 5 | 9 |
| 6 import glob | 10 import glob |
| 7 import os | 11 import os |
| 8 import shlex | 12 import shlex |
| 9 import sys | 13 import sys |
| 10 | 14 |
| 11 print 'Updating projects from gyp files...' | 15 print 'Updating projects from gyp files...' |
| 16 sys.stdout.flush() |
| 17 |
| 18 chrome_src = os.path.join(os.path.dirname(sys.argv[0]), os.pardir) |
| 12 | 19 |
| 13 try: | 20 try: |
| 14 import gyp | 21 import gyp |
| 15 except ImportError, e: | 22 except ImportError, e: |
| 16 sys.path.append(os.path.join(os.path.dirname(sys.argv[0]), '../tools/gyp/pylib
')) | 23 sys.path.append(os.path.join(chrome_src, 'tools', 'gyp', 'pylib')) |
| 17 import gyp | 24 import gyp |
| 18 | 25 |
| 19 if __name__ == '__main__': | 26 if __name__ == '__main__': |
| 20 args = sys.argv[1:] | 27 args = sys.argv[1:] |
| 21 | 28 |
| 22 # If we didn't get a file, check an env var, and then fall back to | 29 # If we didn't get a file, check an env var, and then fall back to |
| 23 # assuming 'src/build/all.gyp' | 30 # assuming 'src/build/all.gyp'. This can't have any backslashes as path |
| 31 # separators even on Windows due to the use of shlex.split. |
| 32 default_gyp_file = 'src/build/all.gyp' |
| 24 if len(args) == 0: | 33 if len(args) == 0: |
| 25 args += shlex.split(os.environ.get('CHROMIUM_GYP_FILE', | 34 args += shlex.split(os.environ.get('CHROMIUM_GYP_FILE', |
| 26 'src/build/all.gyp')) | 35 default_gyp_file)) |
| 27 | 36 |
| 28 # Always include gyp_chromium.gypi | 37 # Always include common.gypi |
| 29 args += ['-I', os.path.join(os.path.dirname(sys.argv[0]),'common.gypi')] | 38 args += ['-I', os.path.join(chrome_src, 'build', 'common.gypi')] |
| 30 | 39 |
| 31 # Optionally add supplemental .gypi files if present. | 40 # Optionally add supplemental .gypi files if present. |
| 32 supplements = glob.glob('src/*/supplement.gypi') | 41 supplements = glob.glob(os.path.join(chrome_src, '*', 'supplement.gypi')) |
| 33 for supplement in supplements: | 42 for supplement in supplements: |
| 34 args += ['-I', supplement] | 43 args += ['-I', supplement] |
| 35 | 44 |
| 36 # Off we go... | 45 # Off we go... |
| 37 sys.exit(gyp.main(args)) | 46 sys.exit(gyp.main(args)) |
| OLD | NEW |