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

Unified Diff: native_client_sdk/src/tools/ncval.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 5 years, 11 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « native_client_sdk/src/tools/nacl_config.py ('k') | native_client_sdk/src/tools/oshelpers.py » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: native_client_sdk/src/tools/ncval.py
diff --git a/native_client_sdk/src/tools/ncval.py b/native_client_sdk/src/tools/ncval.py
index aebfe34afaafcdcaeef68d0b10aa429bf5e700f3..84903991c2d5e8ec5628c34666fb61c222f20198 100755
--- a/native_client_sdk/src/tools/ncval.py
+++ b/native_client_sdk/src/tools/ncval.py
@@ -3,10 +3,10 @@
# Use of this source code is governed by a BSD-style license that can be
# found in the LICENSE file.
-"""Wrapper script for running ncval.
+"""Wrapper script for running the Native Client validator (ncval).
"""
-import optparse
+import argparse
import os
import subprocess
import sys
@@ -28,12 +28,11 @@ def Log(msg):
sys.stderr.write(str(msg) + '\n')
Log.verbose = False
-def main(argv):
- usage = 'Usage: %prog [options] <.nexe | .so>'
- epilog = 'Example: ncval.py my_nexe.nexe'
- parser = optparse.OptionParser(usage, description=__doc__, epilog=epilog)
- parser.add_option('-v', '--verbose', action='store_true',
- help='Verbose output')
+def main(args):
+ parser = argparse.ArgumentParser(description=__doc__)
+ parser.add_argument('-v', '--verbose', action='store_true',
+ help='Verbose output')
+ parser.add_argument('nexe', metavar="EXE", help='Executable to validate')
# To enable bash completion for this command first install optcomplete
# and then add this line to your .bashrc:
@@ -44,11 +43,9 @@ def main(argv):
except ImportError:
pass
- options, args = parser.parse_args(argv)
- if not args:
- parser.error('No executable file specified')
+ options = parser.parse_args(args)
+ nexe = options.nexe
- nexe = args[0]
if options.verbose:
Log.verbose = True
« no previous file with comments | « native_client_sdk/src/tools/nacl_config.py ('k') | native_client_sdk/src/tools/oshelpers.py » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698