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

Side by Side Diff: pydir/szbuild.py

Issue 605283002: Subzero: Change szbuild.py to prefer Subzero by default. (Closed) Base URL: https://chromium.googlesource.com/native_client/pnacl-subzero.git@master
Patch Set: Make the default include logic more intuitive Created 6 years, 2 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 | 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 python2 1 #!/usr/bin/env python2
2 2
3 import argparse 3 import argparse
4 import os 4 import os
5 import pipes 5 import pipes
6 import re 6 import re
7 import sys 7 import sys
8 8
9 from utils import shellcmd 9 from utils import shellcmd
10 from utils import FindBaseNaCl 10 from utils import FindBaseNaCl
(...skipping 201 matching lines...) Expand 10 before | Expand all | Expand 10 after
212 'nm {obj} | sed -n "s/.* [a-zA-Z] //p" > {sym}' 212 'nm {obj} | sed -n "s/.* [a-zA-Z] //p" > {sym}'
213 ).format(obj=obj_sz, sym=sym_sz), echo=args.verbose) 213 ).format(obj=obj_sz, sym=sym_sz), echo=args.verbose)
214 214
215 with open(sym_sz_unescaped) as f: 215 with open(sym_sz_unescaped) as f:
216 sz_syms = f.read().splitlines() 216 sz_syms = f.read().splitlines()
217 re_include_str = BuildRegex(args.include, sz_syms) 217 re_include_str = BuildRegex(args.include, sz_syms)
218 re_exclude_str = BuildRegex(args.exclude, sz_syms) 218 re_exclude_str = BuildRegex(args.exclude, sz_syms)
219 re_include = re.compile(re_include_str) 219 re_include = re.compile(re_include_str)
220 re_exclude = re.compile(re_exclude_str) 220 re_exclude = re.compile(re_exclude_str)
221 # If a symbol doesn't explicitly match re_include or re_exclude, 221 # If a symbol doesn't explicitly match re_include or re_exclude,
222 # the default MatchSymbol() result is False, unless some --exclude 222 # the default MatchSymbol() result is True, unless some --include
223 # args are provided and no --include args are provided. 223 # args are provided.
224 default_match = len(args.exclude) and not len(args.include) 224 default_match = not len(args.include)
225 225
226 whitelist_has_items = False 226 whitelist_has_items = False
227 with open(whitelist_sz_unescaped, 'w') as f: 227 with open(whitelist_sz_unescaped, 'w') as f:
228 for sym in sz_syms: 228 for sym in sz_syms:
229 if MatchSymbol(sym, re_include, re_exclude, default_match): 229 if MatchSymbol(sym, re_include, re_exclude, default_match):
230 f.write(sym + '\n') 230 f.write(sym + '\n')
231 whitelist_has_items = True 231 whitelist_has_items = True
232 shellcmd(( 232 shellcmd((
233 'objcopy --weaken {obj} {weak}' 233 'objcopy --weaken {obj} {weak}'
234 ).format(obj=obj_sz, weak=obj_sz_weak), echo=args.verbose) 234 ).format(obj=obj_sz, weak=obj_sz_weak), echo=args.verbose)
(...skipping 30 matching lines...) Expand all
265 # Put the extra verbose printing at the end. 265 # Put the extra verbose printing at the end.
266 if args.verbose: 266 if args.verbose:
267 print 'PATH={path}'.format(path=os.environ['PATH']) 267 print 'PATH={path}'.format(path=os.environ['PATH'])
268 print 'include={regex}'.format(regex=re_include_str) 268 print 'include={regex}'.format(regex=re_include_str)
269 print 'exclude={regex}'.format(regex=re_exclude_str) 269 print 'exclude={regex}'.format(regex=re_exclude_str)
270 print 'default_match={dm}'.format(dm=default_match) 270 print 'default_match={dm}'.format(dm=default_match)
271 print 'Number of Subzero syms = {num}'.format(num=len(sz_syms)) 271 print 'Number of Subzero syms = {num}'.format(num=len(sz_syms))
272 272
273 if __name__ == '__main__': 273 if __name__ == '__main__':
274 main() 274 main()
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