Chromium Code Reviews| OLD | NEW |
|---|---|
| 1 #!/usr/bin/env python | 1 #!/usr/bin/env python |
| 2 | 2 |
| 3 # Copyright (c) 2011 The Chromium Authors. All rights reserved. | 3 # Copyright (c) 2011 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 cProfile | |
|
Mark Mentovai
2011/05/16 16:42:54
Unneeded?
| |
| 10 import glob | 11 import glob |
| 11 import os | 12 import os |
| 12 import shlex | 13 import shlex |
| 13 import subprocess | 14 import subprocess |
| 14 import sys | 15 import sys |
| 15 | 16 |
| 16 script_dir = os.path.dirname(__file__) | 17 script_dir = os.path.dirname(__file__) |
| 17 chrome_src = os.path.abspath(os.path.join(script_dir, os.pardir)) | 18 chrome_src = os.path.abspath(os.path.join(script_dir, os.pardir)) |
| 18 | 19 |
| 20 # Insert grit into path so that gyp can find it. This speeds gyp up | |
| 21 # considerably. | |
| 22 sys.path.insert(0, os.path.join(chrome_src, 'tools', 'grit')) | |
|
Mark Mentovai
2011/05/16 16:42:54
I find this hard to follow on a quick glance. You’
| |
| 23 | |
| 19 sys.path.insert(0, os.path.join(chrome_src, 'tools', 'gyp', 'pylib')) | 24 sys.path.insert(0, os.path.join(chrome_src, 'tools', 'gyp', 'pylib')) |
| 20 import gyp | 25 import gyp |
| 21 | 26 |
| 22 # On Windows, Psyco shortens warm runs of build/gyp_chromium by about | 27 # On Windows, Psyco shortens warm runs of build/gyp_chromium by about |
| 23 # 20 seconds on a z600 machine with 12 GB of RAM, from 90 down to 70 | 28 # 20 seconds on a z600 machine with 12 GB of RAM, from 90 down to 70 |
| 24 # seconds. Conversely, memory usage of build/gyp_chromium with Psyco | 29 # seconds. Conversely, memory usage of build/gyp_chromium with Psyco |
| 25 # maxes out at about 158 MB vs. 132 MB without it. | 30 # maxes out at about 158 MB vs. 132 MB without it. |
| 26 # | 31 # |
| 27 # Psyco uses native libraries, so we need to load a different | 32 # Psyco uses native libraries, so we need to load a different |
| 28 # installation depending on which OS we are running under. It has not | 33 # installation depending on which OS we are running under. It has not |
| (...skipping 59 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 88 AddInclude(os.path.join(script_dir, 'common.gypi')) | 93 AddInclude(os.path.join(script_dir, 'common.gypi')) |
| 89 AddInclude(os.path.join(script_dir, 'features_override.gypi')) | 94 AddInclude(os.path.join(script_dir, 'features_override.gypi')) |
| 90 | 95 |
| 91 # Optionally add supplemental .gypi files if present. | 96 # Optionally add supplemental .gypi files if present. |
| 92 supplements = glob.glob(os.path.join(chrome_src, '*', 'supplement.gypi')) | 97 supplements = glob.glob(os.path.join(chrome_src, '*', 'supplement.gypi')) |
| 93 for supplement in supplements: | 98 for supplement in supplements: |
| 94 AddInclude(supplement) | 99 AddInclude(supplement) |
| 95 | 100 |
| 96 return result | 101 return result |
| 97 | 102 |
| 98 if __name__ == '__main__': | 103 def main(): |
| 99 args = sys.argv[1:] | 104 args = sys.argv[1:] |
| 100 | 105 |
| 101 # Use the Psyco JIT if available. | 106 # Use the Psyco JIT if available. |
| 102 if psyco: | 107 if psyco: |
| 103 psyco.profile() | 108 psyco.profile() |
| 104 print "Enabled Psyco JIT." | 109 print "Enabled Psyco JIT." |
| 105 | 110 |
| 106 # Fall back on hermetic python if we happen to get run under cygwin. | 111 # Fall back on hermetic python if we happen to get run under cygwin. |
| 107 # TODO(bradnelson): take this out once this issue is fixed: | 112 # TODO(bradnelson): take this out once this issue is fixed: |
| 108 # http://code.google.com/p/gyp/issues/detail?id=177 | 113 # http://code.google.com/p/gyp/issues/detail?id=177 |
| (...skipping 49 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 158 # to enfore syntax checking. | 163 # to enfore syntax checking. |
| 159 syntax_check = os.environ.get('CHROMIUM_GYP_SYNTAX_CHECK') | 164 syntax_check = os.environ.get('CHROMIUM_GYP_SYNTAX_CHECK') |
| 160 if syntax_check and int(syntax_check): | 165 if syntax_check and int(syntax_check): |
| 161 args.append('--check') | 166 args.append('--check') |
| 162 | 167 |
| 163 print 'Updating projects from gyp files...' | 168 print 'Updating projects from gyp files...' |
| 164 sys.stdout.flush() | 169 sys.stdout.flush() |
| 165 | 170 |
| 166 # Off we go... | 171 # Off we go... |
| 167 sys.exit(gyp.main(args)) | 172 sys.exit(gyp.main(args)) |
| 173 | |
| 174 | |
|
Mark Mentovai
2011/05/16 16:42:54
This file seems to use only one blank line between
| |
| 175 if __name__ == '__main__': | |
| 176 #cProfile.run('main()', 'profile') | |
|
Mark Mentovai
2011/05/16 16:42:54
Unneeded?
| |
| 177 main() | |
|
Mark Mentovai
2011/05/16 16:42:54
sys.exit(main(sys.argv[1:])) instead, and adjust m
| |
| OLD | NEW |