Merge pull request #9289 from techhat/issue9270

Add additional python 2.6 checks
This commit is contained in:
C. R. Oldham 2013-12-16 07:51:01 -08:00
commit 46d256d205

View File

@ -536,6 +536,7 @@ def _parse_conf(conf_file=None, in_mem=False):
parsed_args = vars(parser.parse_args(shlex.split(line)))
ret_args = {}
chain = parsed_args['append']
if not sys.version.startswith('2.6'):
if isinstance(chain, list):
chain = chain[0]
for arg in parsed_args:
@ -565,6 +566,9 @@ def _parser():
add_arg = parser.add_argument
# COMMANDS
if sys.version.startswith('2.6'):
add_arg('-A', '--append', dest='append', action='append')
else:
add_arg('-A', '--append', dest='append', action='append', nargs='*')
add_arg('-D', '--delete', dest='delete', action='append')
add_arg('-I', '--insert', dest='insert', action='append')
@ -579,8 +583,13 @@ def _parser():
# PARAMETERS
add_arg('-p', '--protocol', dest='protocol', action='append')
if sys.version.startswith('2.6'):
add_arg('-s', '--source', dest='source', action='append')
add_arg('-d', '--destination', dest='destination', action='append')
else:
add_arg('-s', '--source', dest='source', action='append', nargs='*')
add_arg('-d', '--destination', dest='destination', action='append', nargs='*')
add_arg('-d', '--destination', dest='destination', action='append',
nargs='*')
add_arg('-j', '--jump', dest='jump', action='append')
add_arg('-g', '--goto', dest='goto', action='append')
add_arg('-i', '--in-interface', dest='in-interface', action='append')