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

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

Issue 720233003: [NaCl SDK] Convert python scripts from optparse to argparse. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 6 years, 1 month 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
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 """Helper script for PPAPI's PRESUBMIT.py to detect if additions or removals of 6 """Helper script for PPAPI's PRESUBMIT.py to detect if additions or removals of
7 PPAPI interfaces have been propagated to the Native Client libraries (.dsc 7 PPAPI interfaces have been propagated to the Native Client libraries (.dsc
8 files). 8 files).
9 9
10 For example, if a user adds "ppapi/c/foo.h", we check that the interface has 10 For example, if a user adds "ppapi/c/foo.h", we check that the interface has
11 been added to "native_client_sdk/src/libraries/ppapi/library.dsc". 11 been added to "native_client_sdk/src/libraries/ppapi/library.dsc".
12 """ 12 """
13 13
14 import optparse 14 import argparse
15 import os 15 import os
16 import sys 16 import sys
17 17
18 from build_paths import PPAPI_DIR, SRC_DIR, SDK_LIBRARY_DIR 18 from build_paths import PPAPI_DIR, SRC_DIR, SDK_LIBRARY_DIR
19 import parse_dsc 19 import parse_dsc
20 20
21 21
22 # Add a file to this list if it should not be added to a .dsc file; i.e. if it 22 # Add a file to this list if it should not be added to a .dsc file; i.e. if it
23 # should not be included in the Native Client SDK. This will silence the 23 # should not be included in the Native Client SDK. This will silence the
24 # presubmit warning. 24 # presubmit warning.
(...skipping 137 matching lines...) Expand 10 before | Expand all | Expand 10 after
162 should_fail = False 162 should_fail = False
163 sys.stderr.write(str(e) + '\n') 163 sys.stderr.write(str(e) + '\n')
164 if should_fail: 164 if should_fail:
165 return False 165 return False
166 return True 166 return True
167 167
168 168
169 def main(args): 169 def main(args):
170 usage = '%prog <file>...' 170 usage = '%prog <file>...'
171 description = __doc__ 171 description = __doc__
172 parser = optparse.OptionParser(usage=usage, description=description) 172 parser = argparse.ArgumentParser(usage=usage, description=description)
binji 2014/11/13 23:57:02 I think this one needs more changes (remove usage,
Sam Clegg 2014/11/30 17:55:11 Done.
173 args = parser.parse_args(args)[1] 173 args = parser.parse_args(args)[1]
174 if not args: 174 if not args:
175 parser.error('Expected a PPAPI header or source file.') 175 parser.error('Expected a PPAPI header or source file.')
176 176
177 retval = 0 177 retval = 0
178 lib_files = PartitionFiles(args) 178 lib_files = PartitionFiles(args)
179 directory_list = GetDirectoryList(PPAPI_DIR, relative_to=SRC_DIR) 179 directory_list = GetDirectoryList(PPAPI_DIR, relative_to=SRC_DIR)
180 for lib_name, filenames in lib_files.iteritems(): 180 for lib_name, filenames in lib_files.iteritems():
181 if not filenames: 181 if not filenames:
182 continue 182 continue
(...skipping 10 matching lines...) Expand all
193 is_private = lib_name == 'ppapi_cpp_private' 193 is_private = lib_name == 'ppapi_cpp_private'
194 if not VerifyOrPrintError(rel_dsc_filename, dsc_sources_and_headers, 194 if not VerifyOrPrintError(rel_dsc_filename, dsc_sources_and_headers,
195 changed_filenames, removed_filenames, 195 changed_filenames, removed_filenames,
196 is_private=is_private): 196 is_private=is_private):
197 retval = 1 197 retval = 1
198 return retval 198 return retval
199 199
200 200
201 if __name__ == '__main__': 201 if __name__ == '__main__':
202 sys.exit(main(sys.argv[1:])) 202 sys.exit(main(sys.argv[1:]))
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698