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

Unified Diff: native_client_sdk/src/tools/create_html.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/test_all.py ('k') | native_client_sdk/src/tools/create_nmf.py » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: native_client_sdk/src/tools/create_html.py
diff --git a/native_client_sdk/src/tools/create_html.py b/native_client_sdk/src/tools/create_html.py
index 64f6d89afdaea0247f1832d540494dd9e36f1b84..8647b46a373f99fd855e5c41691bea04bb6556dc 100755
--- a/native_client_sdk/src/tools/create_html.py
+++ b/native_client_sdk/src/tools/create_html.py
@@ -15,7 +15,7 @@ the nmf files. If it is given an nmf it will only create
the html file.
"""
-import optparse
+import argparse
import os
import sys
import subprocess
@@ -160,18 +160,18 @@ def CreateHTML(filenames, options):
def main(argv):
- usage = 'Usage: %prog [options] <.nexe/.pexe or .nmf>'
- epilog = 'Example: create_html.py -o index.html my_nexe.nexe'
- parser = optparse.OptionParser(usage, description=__doc__, epilog=epilog)
- parser.add_option('-v', '--verbose', action='store_true',
- help='Verbose output')
- parser.add_option('-d', '--debug-libs', action='store_true',
- help='When calling create_nmf request debug libaries')
- parser.add_option('-o', '--output', dest='output',
- help='Name of html file to write (default is '
- 'input name with .html extension)',
- metavar='FILE')
-
+ parser = argparse.ArgumentParser(description=__doc__)
+ parser.add_argument('-v', '--verbose', action='store_true',
+ help='Verbose output')
+ parser.add_argument('-d', '--debug-libs', action='store_true',
+ help='When calling create_nmf request debug libaries')
+ parser.add_argument('-o', '--output', dest='output',
+ help='Name of html file to write (default is '
+ 'input name with .html extension)',
+ metavar='FILE')
+ parser.add_argument('exe', metavar='EXE_OR_NMF', nargs='+',
+ help='Executable (.nexe/.pexe) or nmf file to generate '
+ 'html for.')
# To enable bash completion for this command first install optcomplete
# and then add this line to your .bashrc:
# complete -F _optcomplete create_html.py
@@ -181,15 +181,12 @@ def main(argv):
except ImportError:
pass
- options, args = parser.parse_args(argv)
-
- if not args:
- parser.error('no input file specified')
+ options = parser.parse_args(argv)
if options.verbose:
Log.enabled = True
- CreateHTML(args, options)
+ CreateHTML(options.exe, options)
return 0
« no previous file with comments | « native_client_sdk/src/test_all.py ('k') | native_client_sdk/src/tools/create_nmf.py » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698