Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(23)

Side by Side Diff: build/gyp_chromium

Issue 6778017: Add use of Psyco to GYP on Windows. On my z600 with 12 GB of RAM, (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Merge to head. Created 9 years, 8 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « DEPS ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 #!/usr/bin/python 1 #!/usr/bin/python
2 2
3 # Copyright (c) 2009 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 glob 10 import glob
11 import os 11 import os
12 import shlex 12 import shlex
13 import subprocess 13 import subprocess
14 import sys 14 import sys
15 15
16 script_dir = os.path.dirname(__file__) 16 script_dir = os.path.dirname(__file__)
17 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))
18 18
19 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'))
20 import gyp 20 import gyp
21 21
22 # 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
24 # seconds. Conversely, memory usage of build/gyp_chromium with Psyco
25 # maxes out at about 158 MB vs. 132 MB without it.
26 #
27 # Psyco uses native libraries, so we need to load a different
28 # installation depending on which OS we are running under. It has not
29 # been tested whether using Psyco on our Mac and Linux builds is worth
30 # it (the GYP running time is a lot shorter, so the JIT startup cost
31 # may not be worth it).
32 if sys.platform == 'win32':
33 try:
34 sys.path.insert(0, os.path.join(chrome_src, 'third_party', 'psyco_win32'))
35 import psyco
36 except:
37 psyco = None
38 else:
39 psyco = None
40
22 def apply_gyp_environment(file_path=None): 41 def apply_gyp_environment(file_path=None):
23 """ 42 """
24 Reads in a *.gyp_env file and applies the valid keys to os.environ. 43 Reads in a *.gyp_env file and applies the valid keys to os.environ.
25 """ 44 """
26 if not file_path or not os.path.exists(file_path): 45 if not file_path or not os.path.exists(file_path):
27 return 46 return
28 file_contents = open(file_path).read() 47 file_contents = open(file_path).read()
29 try: 48 try:
30 file_data = eval(file_contents, {'__builtins__': None}, None) 49 file_data = eval(file_contents, {'__builtins__': None}, None)
31 except SyntaxError, e: 50 except SyntaxError, e:
(...skipping 40 matching lines...) Expand 10 before | Expand all | Expand 10 after
72 # Optionally add supplemental .gypi files if present. 91 # Optionally add supplemental .gypi files if present.
73 supplements = glob.glob(os.path.join(chrome_src, '*', 'supplement.gypi')) 92 supplements = glob.glob(os.path.join(chrome_src, '*', 'supplement.gypi'))
74 for supplement in supplements: 93 for supplement in supplements:
75 AddInclude(supplement) 94 AddInclude(supplement)
76 95
77 return result 96 return result
78 97
79 if __name__ == '__main__': 98 if __name__ == '__main__':
80 args = sys.argv[1:] 99 args = sys.argv[1:]
81 100
101 # Use the Psyco JIT if available.
102 if psyco:
103 psyco.profile()
104 print "Enabled Psyco JIT."
105
82 # Fall back on hermetic python if we happen to get run under cygwin. 106 # Fall back on hermetic python if we happen to get run under cygwin.
83 # TODO(bradnelson): take this out once this issue is fixed: 107 # TODO(bradnelson): take this out once this issue is fixed:
84 # http://code.google.com/p/gyp/issues/detail?id=177 108 # http://code.google.com/p/gyp/issues/detail?id=177
85 if sys.platform == 'cygwin': 109 if sys.platform == 'cygwin':
86 python_dir = os.path.join(chrome_src, 'third_party', 'python_26') 110 python_dir = os.path.join(chrome_src, 'third_party', 'python_26')
87 env = os.environ.copy() 111 env = os.environ.copy()
88 env['PATH'] = python_dir + os.pathsep + env.get('PATH', '') 112 env['PATH'] = python_dir + os.pathsep + env.get('PATH', '')
89 p = subprocess.Popen( 113 p = subprocess.Popen(
90 [os.path.join(python_dir, 'python.exe')] + sys.argv, 114 [os.path.join(python_dir, 'python.exe')] + sys.argv,
91 env=env, shell=False) 115 env=env, shell=False)
(...skipping 42 matching lines...) Expand 10 before | Expand all | Expand 10 after
134 # to enfore syntax checking. 158 # to enfore syntax checking.
135 syntax_check = os.environ.get('CHROMIUM_GYP_SYNTAX_CHECK') 159 syntax_check = os.environ.get('CHROMIUM_GYP_SYNTAX_CHECK')
136 if syntax_check and int(syntax_check): 160 if syntax_check and int(syntax_check):
137 args.append('--check') 161 args.append('--check')
138 162
139 print 'Updating projects from gyp files...' 163 print 'Updating projects from gyp files...'
140 sys.stdout.flush() 164 sys.stdout.flush()
141 165
142 # Off we go... 166 # Off we go...
143 sys.exit(gyp.main(args)) 167 sys.exit(gyp.main(args))
OLDNEW
« no previous file with comments | « DEPS ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698