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

Unified Diff: native_client_sdk/src/tools/nacl_config.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/lib/tests/quote_test.py ('k') | native_client_sdk/src/tools/ncval.py » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: native_client_sdk/src/tools/nacl_config.py
diff --git a/native_client_sdk/src/tools/nacl_config.py b/native_client_sdk/src/tools/nacl_config.py
index d98b2bcaec56e2a366d24b19b2dbd68c13eece80..e8a712953404ccbe8813c7835621c0efc8fac5d9 100755
--- a/native_client_sdk/src/tools/nacl_config.py
+++ b/native_client_sdk/src/tools/nacl_config.py
@@ -8,7 +8,7 @@
It is similar in behavior to pkg-config or sdl-config.
"""
-import optparse
+import argparse
import os
import posixpath
import sys
@@ -222,27 +222,25 @@ def GetLDFlags():
def main(args):
- usage = 'Usage: %prog [options] <command>'
- parser = optparse.OptionParser(usage=usage, description=__doc__)
- parser.add_option('-t', '--toolchain', help='toolchain name. This can also '
- 'be specified with the NACL_TOOLCHAIN environment '
- 'variable.')
- parser.add_option('-a', '--arch', help='architecture name. This can also be '
- 'specified with the NACL_ARCH environment variable.')
-
- group = optparse.OptionGroup(parser, 'Commands')
- group.add_option('--tool', help='get tool path')
- group.add_option('--cflags',
- help='output all preprocessor and compiler flags',
- action='store_true')
- group.add_option('--libs', '--ldflags', help='output all linker flags',
- action='store_true')
- group.add_option('--include-dirs',
- help='output include dirs, separated by spaces',
- action='store_true')
- parser.add_option_group(group)
-
- options, _ = parser.parse_args(args)
+ parser = argparse.ArgumentParser(description=__doc__)
+ parser.add_argument('-t', '--toolchain', help='toolchain name. This can also '
+ 'be specified with the NACL_TOOLCHAIN environment '
+ 'variable.')
+ parser.add_argument('-a', '--arch', help='architecture name. This can also '
+ 'be specified with the NACL_ARCH environment variable.')
+
+ group = parser.add_argument_group('Commands')
+ group.add_argument('--tool', help='get tool path')
+ group.add_argument('--cflags',
+ help='output all preprocessor and compiler flags',
+ action='store_true')
+ group.add_argument('--libs', '--ldflags', help='output all linker flags',
+ action='store_true')
+ group.add_argument('--include-dirs',
+ help='output include dirs, separated by spaces',
+ action='store_true')
+
+ options = parser.parse_args(args)
# Get toolchain/arch from environment, if not specified on commandline
options.toolchain = options.toolchain or os.getenv('NACL_TOOLCHAIN')
« no previous file with comments | « native_client_sdk/src/tools/lib/tests/quote_test.py ('k') | native_client_sdk/src/tools/ncval.py » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698