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

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 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/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..8667e32c9a198e0bdb6c3985e82798ae9fa9f85e 100755
--- a/native_client_sdk/src/build_tools/easy_template.py
+++ b/native_client_sdk/src/build_tools/easy_template.py
@@ -5,7 +5,7 @@
import copy
import cStringIO
-import optparse
+import argparse
binji 2014/11/13 23:57:01 sort
Sam Clegg 2014/11/30 17:55:11 Done.
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_arguments('template')
+ options = parser.parse_args(args)
- with open(args[0]) as f:
+ with open(options.templet) as f:
binji 2014/11/13 23:57:01 template
Sam Clegg 2014/11/30 17:55:11 Done.
binji 2014/12/08 21:58:20 template :)
Sam Clegg 2015/01/14 15:28:32 Done.
print TemplateToPython(
f.read(), re.compile(STATEMENT_RE), re.compile(EXPR_RE))

Powered by Google App Engine
This is Rietveld 408576698