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

Unified Diff: native_client_sdk/src/build_tools/easy_template.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/dsc_info.py ('k') | native_client_sdk/src/build_tools/generate_notice.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/easy_template.py
diff --git a/native_client_sdk/src/build_tools/easy_template.py b/native_client_sdk/src/build_tools/easy_template.py
index 999bdb1f8816e9090aac4c62156da007e312d6d4..d6b904587c80a393a55fa8cde91a6dcf2a504a4d 100755
--- a/native_client_sdk/src/build_tools/easy_template.py
+++ b/native_client_sdk/src/build_tools/easy_template.py
@@ -3,9 +3,9 @@
# Use of this source code is governed by a BSD-style license that can be
# found in the LICENSE file.
+import argparse
import copy
import cStringIO
-import optparse
import os
import re
import sys
@@ -98,12 +98,11 @@ def RunTemplateString(src, template_dict, statement_re=None, expr_re=None):
def main(args):
- parser = optparse.OptionParser()
- _, args = parser.parse_args(args)
- if not args:
- return
+ parser = argparse.ArgumentParser()
+ parser.add_argument('template')
+ options = parser.parse_args(args)
- with open(args[0]) as f:
+ with open(options.template) as f:
print TemplateToPython(
f.read(), re.compile(STATEMENT_RE), re.compile(EXPR_RE))
« no previous file with comments | « native_client_sdk/src/build_tools/dsc_info.py ('k') | native_client_sdk/src/build_tools/generate_notice.py » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698