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

Side by Side Diff: pydir/build-pnacl-ir.py

Issue 565553002: Subzero: Print defaults as appropriate in python script help text. (Closed) Base URL: https://chromium.googlesource.com/native_client/pnacl-subzero.git@master
Patch Set: Created 6 years, 3 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
« no previous file with comments | « no previous file | pydir/crosstest.py » ('j') | 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 python2 1 #!/usr/bin/env python2
2 2
3 import argparse 3 import argparse
4 import os 4 import os
5 import tempfile 5 import tempfile
6 from utils import shellcmd 6 from utils import shellcmd
7 from utils import FindBaseNaCl 7 from utils import FindBaseNaCl
8 8
9 if __name__ == '__main__': 9 if __name__ == '__main__':
10 argparser = argparse.ArgumentParser() 10 argparser = argparse.ArgumentParser()
11 argparser.add_argument('cfile', nargs='+', type=str, 11 argparser.add_argument('cfile', nargs='+', type=str,
12 help='C file(s) to convert') 12 help='C file(s) to convert')
13 argparser.add_argument('--dir', nargs='?', type=str, default='.', 13 argparser.add_argument('--dir', nargs='?', type=str, default='.',
14 help='Output directory') 14 help='Output directory. Default "%(default)s".')
15 argparser.add_argument('--disable-verify', action='store_true') 15 argparser.add_argument('--disable-verify', action='store_true')
16 args = argparser.parse_args() 16 args = argparser.parse_args()
17 17
18 nacl_root = FindBaseNaCl() 18 nacl_root = FindBaseNaCl()
19 # Prepend bin to $PATH. 19 # Prepend bin to $PATH.
20 os.environ['PATH'] = ( 20 os.environ['PATH'] = (
21 nacl_root + '/toolchain/linux_x86/pnacl_newlib/bin' + os.pathsep + 21 nacl_root + '/toolchain/linux_x86/pnacl_newlib/bin' + os.pathsep +
22 os.pathsep + os.environ['PATH']) 22 os.pathsep + os.environ['PATH'])
23 23
24 tempdir = tempfile.mkdtemp() 24 tempdir = tempfile.mkdtemp()
25 25
26 for cname in args.cfile: 26 for cname in args.cfile:
27 basename = os.path.splitext(cname)[0] 27 basename = os.path.splitext(cname)[0]
28 llname = os.path.join(tempdir, basename + '.ll') 28 llname = os.path.join(tempdir, basename + '.ll')
29 pnaclname = basename + '.pnacl.ll' 29 pnaclname = basename + '.pnacl.ll'
30 pnaclname = os.path.join(args.dir, pnaclname) 30 pnaclname = os.path.join(args.dir, pnaclname)
31 31
32 shellcmd('pnacl-clang -O2 -c {0} -o {1}'.format(cname, llname)) 32 shellcmd('pnacl-clang -O2 -c {0} -o {1}'.format(cname, llname))
33 shellcmd('pnacl-opt ' + 33 shellcmd('pnacl-opt ' +
34 '-pnacl-abi-simplify-preopt -pnacl-abi-simplify-postopt' + 34 '-pnacl-abi-simplify-preopt -pnacl-abi-simplify-postopt' +
35 ('' if args.disable_verify else 35 ('' if args.disable_verify else
36 ' -verify-pnaclabi-module -verify-pnaclabi-functions') + 36 ' -verify-pnaclabi-module -verify-pnaclabi-functions') +
37 ' -pnaclabi-allow-debug-metadata' 37 ' -pnaclabi-allow-debug-metadata'
38 ' {0} -S -o {1}'.format(llname, pnaclname)) 38 ' {0} -S -o {1}'.format(llname, pnaclname))
OLDNEW
« no previous file with comments | « no previous file | pydir/crosstest.py » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698