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 |