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

Unified Diff: native_client_sdk/src/tools/fix_deps.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/decode_dump.py ('k') | native_client_sdk/src/tools/fix_manifest.py » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: native_client_sdk/src/tools/fix_deps.py
diff --git a/native_client_sdk/src/tools/fix_deps.py b/native_client_sdk/src/tools/fix_deps.py
index 31e7627af5dfe8914791778ea977f6ea704f1f92..f5a9cc8af348aec0bc5ade3dbbc7fedd658c8b26 100755
--- a/native_client_sdk/src/tools/fix_deps.py
+++ b/native_client_sdk/src/tools/fix_deps.py
@@ -12,8 +12,8 @@ the build to be broken.
See http://mad-scientist.net/make/autodep.html for more details of the problem.
"""
+import argparse
import os
-import optparse
import sys
TAG_LINE = '# Updated by fix_deps.py\n'
@@ -82,24 +82,20 @@ def FixupDepFile(filename, output_filename=None):
def main(argv):
- usage = "usage: %prog [options] <dep_file>"
- parser = optparse.OptionParser(usage=usage, description=__doc__)
- parser.add_option('-o', '--output', help='Output filename (defaults to '
+ parser = argparse.ArgumentParser(description=__doc__)
+ parser.add_argument('-o', '--output', help='Output filename (defaults to '
'input name with .deps extension')
- parser.add_option('-c', '--clean', action='store_true',
+ parser.add_argument('-c', '--clean', action='store_true',
help='Remove input file after writing output')
- options, args = parser.parse_args(argv)
- if not args:
- raise parser.error('No input file specified')
- if len(args) > 1:
- raise parser.error('Only one argument supported')
- input_filename = args[0]
+ parser.add_argument('dep_file')
+ options = parser.parse_args(argv)
output_filename = options.output
if not output_filename:
- output_filename = os.path.splitext(input_filename)[0] + '.deps'
- FixupDepFile(input_filename, output_filename)
- if options.clean and input_filename != output_filename:
- os.remove(input_filename)
+ output_filename = os.path.splitext(options.dep_file)[0] + '.deps'
+ FixupDepFile(options.dep_file, output_filename)
+ if options.clean and options.dep_file != output_filename:
+ os.remove(options.dep_file)
+
return 0
« no previous file with comments | « native_client_sdk/src/tools/decode_dump.py ('k') | native_client_sdk/src/tools/fix_manifest.py » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698