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

Unified Diff: native_client_sdk/src/doc/doxygen/generate_docs.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 6 years, 1 month 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
Index: native_client_sdk/src/doc/doxygen/generate_docs.py
diff --git a/native_client_sdk/src/doc/doxygen/generate_docs.py b/native_client_sdk/src/doc/doxygen/generate_docs.py
index c28b6b260fe57f4ebab506ff839472aec1af2f6e..cb618db791a255723afa9904e6e7788fb257596e 100755
--- a/native_client_sdk/src/doc/doxygen/generate_docs.py
+++ b/native_client_sdk/src/doc/doxygen/generate_docs.py
@@ -1,12 +1,14 @@
#!/usr/bin/python
-
# Copyright (c) 2014 The Chromium Authors. All rights reserved.
# Use of this source code is governed by a BSD-style license that can be
# found in the LICENSE file.
+"""Script to regenerate API docs using doxygen.
+"""
+
import collections
import json
-import optparse
+import argparse
binji 2014/11/13 23:57:02 sort
Sam Clegg 2014/11/30 17:55:12 Done.
import os
import shutil
import subprocess
@@ -228,7 +230,7 @@ def RunRstIndex(kind, channel, pepper_version, out_dirname, out_rst_filename):
'--channel', channel,
'--version', pepper_version,
out_dirname,
- '-o', out_rst_filename]
+ out_rst_filename]
Trace('Running rst_index:\n %s' % ' '.join(cmd))
subprocess.check_call(cmd)
@@ -289,20 +291,18 @@ def GenerateDocs(root_dirname, channel, pepper_version, branch):
def main(argv):
- parser = optparse.OptionParser(usage='Usage: %prog [options] <out_directory>')
- parser.add_option('-v', '--verbose',
+ parser = argparse.ArgumentParser(description=__doc__)
+ parser.add_argument('-v', '--verbose',
help='Verbose output', action='store_true')
binji 2014/11/13 23:57:02 nit: align
Sam Clegg 2014/11/30 17:55:12 Done.
- options, dirs = parser.parse_args(argv)
+ parser.add_argument('dir')
binji 2014/11/13 23:57:02 better name: out_directory?
Sam Clegg 2014/11/30 17:55:12 Done.
+ options = parser.parse_args(argv)
if options.verbose:
Trace.verbose = True
- if len(dirs) != 1:
- parser.error('Expected an output directory')
-
channel_info = GetChannelInfo()
for channel, info in channel_info.iteritems():
- GenerateDocs(dirs[0], channel, info.version, info.branch)
+ GenerateDocs(options.dir, channel, info.version, info.branch)
return 0

Powered by Google App Engine
This is Rietveld 408576698