Chromium Code Reviews| Index: build/win/reorder-imports.py |
| diff --git a/build/win/reorder-imports.py b/build/win/reorder-imports.py |
| new file mode 100755 |
| index 0000000000000000000000000000000000000000..f9bb85168b0d33fb7d1443969e3c6fda53d2865a |
| --- /dev/null |
| +++ b/build/win/reorder-imports.py |
| @@ -0,0 +1,46 @@ |
| +#!/usr/bin/env python |
| +# Copyright 2013 The Chromium Authors. All rights reserved. |
| +# Use of this source code is governed by a BSD-style license that can be |
| +# found in the LICENSE file. |
| + |
| +import glob |
| +import optparse |
| +import os |
| +import shutil |
| +import subprocess |
| +import sys |
| + |
| +def reorder_imports(input_dir, output_dir): |
| + """Run swapimports.exe on the initial chrome.exe, and write to the output |
| + directory. Also copy over any related files that might be needed |
| + (pdbs, manifests etc.). |
| + """ |
| + input_image = '--input-image=%s' % (os.path.join(input_dir, 'chrome.exe')) |
| + output_image = '--output-image=%s' % (os.path.join(output_dir, 'chrome.exe')) |
| + |
| + swap_exe = os.path.join( |
| + __file__, '..\\..\\..\\third_party\\syzygy\\binaries\\exe\\swapimport.exe') |
|
robertshield
2014/01/11 02:16:07
are in-statement indents 2 or 4 spaces in Chromium
|
| + subprocess.call( |
| + [swap_exe, input_image, output_image, '--overwrite', 'chrome_elf.dll']) |
| + |
| + for fname in glob.iglob(os.path.join(input_dir, 'chrome.exe.*')): |
| + shutil.copy(fname, os.path.join(output_dir, os.path.basename(fname))) |
| + return 0 |
| + |
| + |
| +def main(argv): |
| + usage = 'reorder_imports.py -i <input_dir> -o <output_dir>' |
| + parser = optparse.OptionParser(usage=usage) |
| + parser.add_option('-i', '--input', help='reorder chrome.exe in DIR', |
| + metavar='DIR') |
| + parser.add_option('-o', '--output', help='write new chrome.exe to DIR', |
| + metavar='DIR') |
| + opts, args = parser.parse_args() |
| + |
| + if not opts.input or not opts.output: |
| + print 'Please provide and input and output directory' |
| + return 0; |
| + return reorder_imports(opts.input, opts.output) |
| + |
| +if __name__ == "__main__": |
| + sys.exit(main(sys.argv[1:])) |