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

Side by Side Diff: build/win/reorder-imports.py

Issue 137643003: Temporary fix for telemetry builds (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 6 years, 11 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 | « no previous file | 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/env python 1 #!/usr/bin/env python
2 # Copyright 2014 The Chromium Authors. All rights reserved. 2 # Copyright 2014 The Chromium Authors. All rights reserved.
3 # Use of this source code is governed by a BSD-style license that can be 3 # Use of this source code is governed by a BSD-style license that can be
4 # found in the LICENSE file. 4 # found in the LICENSE file.
5 5
6 import glob 6 import glob
7 import optparse 7 import optparse
8 import os 8 import os
9 import platform
9 import shutil 10 import shutil
10 import subprocess 11 import subprocess
11 import sys 12 import sys
12 13
13 def reorder_imports(input_dir, output_dir): 14 def reorder_imports(input_dir, output_dir):
14 """Run swapimports.exe on the initial chrome.exe, and write to the output 15 """Run swapimports.exe on the initial chrome.exe, and write to the output
15 directory. Also copy over any related files that might be needed 16 directory. Also copy over any related files that might be needed
16 (pdbs, manifests etc.). 17 (pdbs, manifests etc.).
17 """ 18 """
18 input_image = '--input-image=%s' % (os.path.join(input_dir, 'chrome.exe')) 19 input_image = '--input-image=%s' % (os.path.join(input_dir, 'chrome.exe'))
19 output_image = '--output-image=%s' % (os.path.join(output_dir, 'chrome.exe')) 20 output_image = '--output-image=%s' % (os.path.join(output_dir, 'chrome.exe'))
20 21
21 swap_exe = os.path.join( 22 # TODO(caitkp): Remove this once swapimport works on x64 builds.
22 __file__, 23 if platform.architecture()[0] == '64bit':
scottmg 2014/01/19 22:33:33 I don't thing this will work. It's testing the arc
23 '..\\..\\..\\third_party\\syzygy\\binaries\\exe\\swapimport.exe') 24 shutil.copy(os.path.join(input_dir, 'chrome.exe'),
24 subprocess.call( 25 os.path.join(output_dir, 'chrome.exe'))
25 [swap_exe, input_image, output_image, '--overwrite', 'chrome_elf.dll']) 26 else:
27 swap_exe = os.path.join(
28 __file__,
29 '..\\..\\..\\third_party\\syzygy\\binaries\\exe\\swapimport.exe')
30 subprocess.call(
31 [swap_exe, input_image, output_image, '--overwrite', 'chrome_elf.dll'])
26 32
27 for fname in glob.iglob(os.path.join(input_dir, 'chrome.exe.*')): 33 for fname in glob.iglob(os.path.join(input_dir, 'chrome.exe.*')):
28 shutil.copy(fname, os.path.join(output_dir, os.path.basename(fname))) 34 shutil.copy(fname, os.path.join(output_dir, os.path.basename(fname)))
29 return 0 35 return 0
30 36
31 37
32 def main(argv): 38 def main(argv):
33 usage = 'reorder_imports.py -i <input_dir> -o <output_dir>' 39 usage = 'reorder_imports.py -i <input_dir> -o <output_dir>'
34 parser = optparse.OptionParser(usage=usage) 40 parser = optparse.OptionParser(usage=usage)
35 parser.add_option('-i', '--input', help='reorder chrome.exe in DIR', 41 parser.add_option('-i', '--input', help='reorder chrome.exe in DIR',
36 metavar='DIR') 42 metavar='DIR')
37 parser.add_option('-o', '--output', help='write new chrome.exe to DIR', 43 parser.add_option('-o', '--output', help='write new chrome.exe to DIR',
38 metavar='DIR') 44 metavar='DIR')
39 opts, args = parser.parse_args() 45 opts, args = parser.parse_args()
40 46
41 if not opts.input or not opts.output: 47 if not opts.input or not opts.output:
42 parser.error('Please provide and input and output directory') 48 parser.error('Please provide and input and output directory')
43 return reorder_imports(opts.input, opts.output) 49 return reorder_imports(opts.input, opts.output)
44 50
45 if __name__ == "__main__": 51 if __name__ == "__main__":
46 sys.exit(main(sys.argv[1:])) 52 sys.exit(main(sys.argv[1:]))
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698