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

Unified Diff: native_client_sdk/src/build_tools/dsc_info.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/build_tools/dsc2gyp.py ('k') | native_client_sdk/src/build_tools/easy_template.py » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: native_client_sdk/src/build_tools/dsc_info.py
diff --git a/native_client_sdk/src/build_tools/dsc_info.py b/native_client_sdk/src/build_tools/dsc_info.py
index ac08faee093de8f578577414e56d4047c5ec4888..947f52b48c4dc2b8f7af1f09c26181a1c2b64806 100755
--- a/native_client_sdk/src/build_tools/dsc_info.py
+++ b/native_client_sdk/src/build_tools/dsc_info.py
@@ -5,7 +5,7 @@
"""Extracts information from a library.dsc file."""
-import optparse
+import argparse
import os
import sys
@@ -32,25 +32,23 @@ def GetSources(lib_dir, tree, target_name):
return result
-def DoMain(argv):
- "Entry point for gyp's pymod_do_main command."
- parser = optparse.OptionParser(usage='%prog: [OPTIONS] TARGET')
+def DoMain(args):
+ """Entry point for gyp's pymod_do_main command."""
+ parser = argparse.ArgumentParser(description=__doc__)
# Give a clearer error message when this is used as a module.
parser.prog = 'dsc_info'
- parser.add_option('-s', '--sources',
+ parser.add_argument('-s', '--sources',
help='Print a list of source files for the target',
action='store_true', default=False)
- parser.add_option('-l', '--libdir',
+ parser.add_argument('-l', '--libdir',
help='Directory where the library.dsc file is located',
metavar='DIR')
- options, args = parser.parse_args(argv)
- if len(args) != 1:
- parser.error('Expecting exactly one argument.')
- target = args[0]
+ parser.add_argument('target')
+ options = parser.parse_args(args)
libdir = options.libdir or ''
tree = parse_dsc.LoadProject(os.path.join(libdir, 'library.dsc'))
if options.sources:
- return '\n'.join(GetSources(libdir, tree, target))
+ return '\n'.join(GetSources(libdir, tree, options.target))
parser.error('No action specified')
« no previous file with comments | « native_client_sdk/src/build_tools/dsc2gyp.py ('k') | native_client_sdk/src/build_tools/easy_template.py » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698