Chromium Code Reviews| OLD | NEW |
|---|---|
| 1 #!/usr/bin/python | 1 #!/usr/bin/python |
| 2 # Copyright (c) 2011 The Chromium Authors. All rights reserved. | 2 # Copyright (c) 2011 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 optparse | 6 import optparse |
| 7 import os | 7 import os |
| 8 import re | 8 import re |
| 9 import shutil | 9 import shutil |
| 10 import subprocess | 10 import subprocess |
| (...skipping 22 matching lines...) Expand all Loading... | |
| 33 'arm-thumb2' : 'pnacl', | 33 'arm-thumb2' : 'pnacl', |
| 34 'x86-32': 'i686', | 34 'x86-32': 'i686', |
| 35 'x86-64': 'x86_64'}.get(platform, uplatform) | 35 'x86-64': 'x86_64'}.get(platform, uplatform) |
| 36 cplatform = { | 36 cplatform = { |
| 37 'win32': 'win', | 37 'win32': 'win', |
| 38 'cygwin': 'win', | 38 'cygwin': 'win', |
| 39 'darwin': 'mac', | 39 'darwin': 'mac', |
| 40 }.get(sys.platform, 'linux') | 40 }.get(sys.platform, 'linux') |
| 41 if platform in ['arm', 'arm-thumb2']: | 41 if platform in ['arm', 'arm-thumb2']: |
| 42 cmd = [ | 42 cmd = [ |
| 43 '../native_client/toolchain/pnacl_linux_x86_64_newlib/bin/' + | 43 os.path.join(SRC_DIR, 'native_client', 'toolchain', |
| 44 platform2 + '-strip', | 44 'pnacl_linux_x86_64_newlib', 'bin', |
| 45 platform2 + '-strip'), | |
|
Ryan Sleevi
2011/11/12 04:29:46
nit: Alignment (this by two spaces, previous line
| |
| 45 '--strip-debug', src, '-o', dst | 46 '--strip-debug', src, '-o', dst |
| 46 ] | 47 ] |
| 47 else: | 48 else: |
| 48 cmd = [ | 49 cmd = [ |
| 49 '../native_client/toolchain/' + cplatform + '_x86_newlib/bin/' + | 50 os.path.join(SRC_DIR, 'native_client', 'toolchain', |
| 50 platform2 + '-nacl-strip', | 51 cplatform + '_x86_newlib', 'bin', |
| 52 platform2 + '-nacl-strip'), | |
| 51 '--strip-debug', src, '-o', dst | 53 '--strip-debug', src, '-o', dst |
| 52 ] | 54 ] |
| 53 print 'Running: ' + ' '.join(cmd) | 55 print 'Running: ' + ' '.join(cmd) |
| 54 p = subprocess.Popen(cmd, cwd=SCRIPT_DIR) | 56 p = subprocess.Popen(cmd, cwd=SCRIPT_DIR) |
| 55 p.wait() | 57 p.wait() |
| 56 if p.returncode != 0: | 58 if p.returncode != 0: |
| 57 sys.exit(4) | 59 sys.exit(4) |
| 58 | 60 |
| 59 | 61 |
| 60 def Main(argv): | 62 def Main(argv): |
| 61 parser = optparse.OptionParser() | 63 parser = optparse.OptionParser() |
| 62 parser.add_option('--platform', dest='platforms', | 64 parser.add_option('--platform', dest='platforms', |
| 63 help='select a platform to strip') | 65 help='select a platform to strip') |
| 64 parser.add_option('--src', dest='src', | 66 parser.add_option('--src', dest='src', |
| 65 help='source IRT file') | 67 help='source IRT file') |
| 66 parser.add_option('--dst', dest='dst', | 68 parser.add_option('--dst', dest='dst', |
| 67 help='destination IRT file') | 69 help='destination IRT file') |
| 68 (options, args) = parser.parse_args(argv[1:]) | 70 (options, args) = parser.parse_args(argv[1:]) |
| 69 if args or not options.platforms: | 71 if args or not options.platforms: |
| 70 parser.print_help() | 72 parser.print_help() |
| 71 sys.exit(1) | 73 sys.exit(1) |
| 72 | 74 |
| 73 StripIRT(options.platforms, options.src, options.dst) | 75 StripIRT(options.platforms, options.src, options.dst) |
| 74 | 76 |
| 75 | 77 |
| 76 if __name__ == '__main__': | 78 if __name__ == '__main__': |
| 77 Main(sys.argv) | 79 Main(sys.argv) |
| OLD | NEW |