You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@qpid.apache.org by kw...@apache.org on 2014/12/23 14:13:28 UTC
svn commit: r1647568 -
/qpid/trunk/qpid/java/perftests/etc/json_config_tool.py
Author: kwall
Date: Tue Dec 23 13:13:28 2014
New Revision: 1647568
URL: http://svn.apache.org/r1647568
Log:
QPID-6284: [Java Broker Tests] Make json_config_tool.py compatible with Python 2.6 (avoid argparse)
Modified:
qpid/trunk/qpid/java/perftests/etc/json_config_tool.py
Modified: qpid/trunk/qpid/java/perftests/etc/json_config_tool.py
URL: http://svn.apache.org/viewvc/qpid/trunk/qpid/java/perftests/etc/json_config_tool.py?rev=1647568&r1=1647567&r2=1647568&view=diff
==============================================================================
--- qpid/trunk/qpid/java/perftests/etc/json_config_tool.py (original)
+++ qpid/trunk/qpid/java/perftests/etc/json_config_tool.py Tue Dec 23 13:13:28 2014
@@ -22,7 +22,29 @@ from StringIO import StringIO
import json
import sys
import re
-import argparse
+
+objname = None
+attrname = None
+attrvalue = None
+
+try:
+ import argparse
+
+ parser = argparse.ArgumentParser(description='Adds (or updates) a attribute name/value pair of an existing object within a Java Broker config.json')
+ parser.add_argument("objectname", help='Name of the object e.g. httpManagement')
+ parser.add_argument("attrname", help='Name of the attribute to add or update e.g. httpBasicAuthenticationEnabled')
+ parser.add_argument("attrvalue", help='Value of the attribute e.g. true')
+ args = parser.parse_args()
+
+ objname = args.objectname
+ attrname = args.attrname
+ attrvalue = args.attrvalue
+except ImportError:
+ objname = sys.argv[1]
+ attrname = sys.argv[2]
+ attrvalue = sys.argv[3]
+ pass
+
def transform(data):
if isinstance(data, tuple):
@@ -37,17 +59,6 @@ def transform(data):
else:
return data
-
-parser = argparse.ArgumentParser(description='Adds (or updates) a attribute name/value pair of an existing object within a Java Broker config.json')
-parser.add_argument("objectname", help='Name of the object e.g. httpManagement')
-parser.add_argument("attrname", help='Name of the attribute to add or update e.g. httpBasicAuthenticationEnabled')
-parser.add_argument("attrvalue", help='Value of the attribute e.g. true')
-args = parser.parse_args()
-
-objname = args.objectname
-attrname = args.attrname
-attrvalue = args.attrvalue
-
# Expects a config.json to be provided on stdin, write the resulting json to stdout.
lines = []
---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@qpid.apache.org
For additional commands, e-mail: commits-help@qpid.apache.org