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

Side by Side Diff: native_client_sdk/src/build_tools/verify_filelist.py

Issue 16336017: [NaCl SDK] Make verification failures a little easier to read. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: feedback Created 7 years, 6 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 | « native_client_sdk/src/build_tools/sdk_files.list ('k') | 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 python 1 #!/usr/bin/env python
2 # Copyright (c) 2013 The Chromium Authors. All rights reserved. 2 # Copyright (c) 2013 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 sys 9 import sys
10 10
(...skipping 19 matching lines...) Expand all
30 30
31 class VerifyException(Exception): 31 class VerifyException(Exception):
32 pass 32 pass
33 33
34 class Rules(object): 34 class Rules(object):
35 def __init__(self, platform, filename, contents=None): 35 def __init__(self, platform, filename, contents=None):
36 self.glob_prefixes = [] 36 self.glob_prefixes = []
37 self.exact_filenames = set() 37 self.exact_filenames = set()
38 self.filename = filename 38 self.filename = filename
39 self.platform = platform 39 self.platform = platform
40 self.exe_ext = '.exe' if platform == 'win' else ''
40 41
41 if platform not in VALID_PLATFORMS: 42 if platform not in VALID_PLATFORMS:
42 raise ParseException(self.filename, 1, 'Unknown platform %s' % platform) 43 raise ParseException(self.filename, 1, 'Unknown platform %s' % platform)
43 44
44 if not contents: 45 if not contents:
45 with open(filename) as f: 46 with open(filename) as f:
46 contents = f.read() 47 contents = f.read()
47 48
48 for line_no, rule in enumerate(contents.split('\n')): 49 for line_no, rule in enumerate(contents.split('\n')):
49 rule = rule.strip() 50 rule = rule.strip()
(...skipping 10 matching lines...) Expand all
60 msg = 'Unknown platform(s) %s.' % ( 61 msg = 'Unknown platform(s) %s.' % (
61 ', '.join('"%s"' % platform for platform in unknown_platforms)) 62 ', '.join('"%s"' % platform for platform in unknown_platforms))
62 raise ParseException(self.filename, line_no, msg) 63 raise ParseException(self.filename, line_no, msg)
63 if self.platform not in platforms: 64 if self.platform not in platforms:
64 return 65 return
65 66
66 # If this platform is included, strip the [...] part. 67 # If this platform is included, strip the [...] part.
67 pattern = match.group(2) 68 pattern = match.group(2)
68 69
69 pattern = pattern.replace('${PLATFORM}', self.platform) 70 pattern = pattern.replace('${PLATFORM}', self.platform)
71 pattern = pattern.replace('${EXE_EXT}', self.exe_ext)
70 72
71 if '*' in pattern: 73 if '*' in pattern:
72 # glob pattern 74 # glob pattern
73 # We only support * at the end. 75 # We only support * at the end.
74 if pattern.find('*') != len(pattern) - 1: 76 if pattern.find('*') != len(pattern) - 1:
75 msg = '* is only allowed at the end of the line.' 77 msg = '* is only allowed at the end of the line.'
76 raise ParseException(self.filename, line_no, msg) 78 raise ParseException(self.filename, line_no, msg)
77 79
78 # Remove the * 80 # Remove the *
79 pattern = pattern[:-1] 81 pattern = pattern[:-1]
(...skipping 87 matching lines...) Expand 10 before | Expand all | Expand 10 after
167 print >> sys.stderr, 'Error parsing rules:\n', e 169 print >> sys.stderr, 'Error parsing rules:\n', e
168 return 1 170 return 1
169 except VerifyException, e: 171 except VerifyException, e:
170 print >> sys.stderr, 'Error verifying file list:\n', e 172 print >> sys.stderr, 'Error verifying file list:\n', e
171 return 1 173 return 1
172 return 0 174 return 0
173 175
174 176
175 if __name__ == '__main__': 177 if __name__ == '__main__':
176 sys.exit(main(sys.argv[1:])) 178 sys.exit(main(sys.argv[1:]))
OLDNEW
« no previous file with comments | « native_client_sdk/src/build_tools/sdk_files.list ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698