Chromium Code Reviews| 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 2066487b3ea734354a43bab770f0c040a78480aa..c6aa1ea3e00607f16d69073070048ef65ff99357 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,12 @@ 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('args', metavar="EXE", nargs='+', |
|
binji
2014/11/13 23:57:04
exes?
Sam Clegg
2014/11/30 17:55:13
Done.
|
| + help='Executable to validate') |
| # To enable bash completion for this command first install optcomplete |
| # and then add this line to your .bashrc: |
| @@ -44,11 +44,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 = args[0] |
| + nexe = options.args[0] |
| if options.verbose: |
| Log.verbose = True |