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

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

Issue 109483003: Make sure Chrome_elf.dll imports are correct and that it the first import of chrome.exe (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Use swapimports.exe for maintaining import order instead of gyp twiddling 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 | chrome/chrome_exe.gypi » ('j') | chrome/chrome_exe.gypi » ('J')
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
(Empty)
1 #!/usr/bin/env python
2 # Copyright 2013 The Chromium Authors. All rights reserved.
3 # Use of this source code is governed by a BSD-style license that can be
4 # found in the LICENSE file.
5
6 import shutil
csharp 2014/01/09 21:07:54 alphabetize imports
Cait (Slow) 2014/01/10 22:00:54 Done.
7 import sys
8 import os
9 import getopt
10 import subprocess
11 import glob
12
13 def reorder_imports(input_dir, output_dir):
14 """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 (pdbs, manifests etc.)."""
csharp 2014/01/09 21:07:54 Nit: move the ending """ to a newline
Cait (Slow) 2014/01/10 22:00:54 Done.
17
18 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
21 swap_exe = os.path.join(
22 __file__, '..\\..\\..\\third_party\\syzygy\\binaries\\exe\\swapimport.exe')
23 subprocess.call(
24 [swap_exe, input_image, output_image, '--overwrite', 'chrome_elf.dll'])
25
26 for fname in glob.glob(os.path.join(input_dir, 'chrome.exe.*')):
csharp 2014/01/09 21:07:54 use glob.iglob so we use an iterator (less memory)
Cait (Slow) 2014/01/10 22:00:54 Done.
27 shutil.copy(fname, os.path.join(output_dir, os.path.basename(fname)))
28 return 0
29
csharp 2014/01/09 21:07:54 Nit: 2 blank lines
Cait (Slow) 2014/01/10 22:00:54 Done.
30 def main(argv):
31 input_dir = ''
32 output_dir = ''
33 try:
34 opts, args = getopt.getopt(argv,"hi:o:",["idir=","odir="])
csharp 2014/01/09 21:07:54 optparse is easier to use (and more pythonic)
Cait (Slow) 2014/01/10 22:00:54 Done.
35 except getopt.GetoptError:
36 print 'reorder_imports.py -i <input_dir> -o <output_dir>'
37 sys.exit(2)
38 for opt, arg in opts:
39 if opt == '-h':
40 print 'test.py -i <input_dir> -o <output_dir>'
41 sys.exit()
42 elif opt in ("-i", "--idir"):
43 input_dir = arg
44 elif opt in ("-o", "--odir"):
45 output_dir = arg
46 return reorder_imports(input_dir, output_dir)
47
48 if __name__ == "__main__":
49 sys.exit(main(sys.argv[1:]))
OLDNEW
« no previous file with comments | « no previous file | chrome/chrome_exe.gypi » ('j') | chrome/chrome_exe.gypi » ('J')

Powered by Google App Engine
This is Rietveld 408576698