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

Unified Diff: native_client_sdk/src/doc/doxygen/doxy_cleanup.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
Index: native_client_sdk/src/doc/doxygen/doxy_cleanup.py
diff --git a/native_client_sdk/src/doc/doxygen/doxy_cleanup.py b/native_client_sdk/src/doc/doxygen/doxy_cleanup.py
index d90f214f8e4f78a56be1a78a345091e354cbb0f3..05c02c29de0c01902a4ff9637dc72fd762e73e4b 100755
--- a/native_client_sdk/src/doc/doxygen/doxy_cleanup.py
+++ b/native_client_sdk/src/doc/doxygen/doxy_cleanup.py
@@ -7,12 +7,13 @@
that they are suitable for publication on a Google documentation site.
'''
+import argparse
import glob
-import optparse
import os
import re
import shutil
import sys
+
try:
from BeautifulSoup import BeautifulSoup, Tag
except (ImportError, NotImplementedError):
@@ -147,24 +148,23 @@ class HTMLFixer(object):
return html
-def main(argv):
+def main(args):
"""Main entry for the doxy_cleanup utility
doxy_cleanup cleans up the html files generated by doxygen.
"""
- parser = optparse.OptionParser(usage='Usage: %prog [options] directory')
- parser.add_option('-v', '--verbose', help='verbose output.',
- action='store_true')
- options, files = parser.parse_args(argv)
+ parser = argparse.ArgumentParser(description=__doc__)
+ parser.add_argument('-v', '--verbose', help='verbose output.',
+ action='store_true')
+ parser.add_argument('directory')
- if len(files) != 1:
- parser.error('Expected one directory')
+ options = parser.parse_args(args)
if options.verbose:
Trace.verbose = True
- root_dir = files[0]
+ root_dir = options.directory
html_dir = os.path.join(root_dir, 'html')
# Doxygen puts all files in an 'html' directory.
« no previous file with comments | « native_client_sdk/src/build_tools/verify_ppapi.py ('k') | native_client_sdk/src/doc/doxygen/generate_docs.py » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698