repeated fix for python version

This commit is contained in:
Mathew Guest 2020-07-19 00:42:28 -06:00
parent ffc39641be
commit 157a9e501c

@ -83,6 +83,7 @@ class CommandTree:
# NOTE(MG) Fix below strategizes whether to pass in 'required'
# paremter to ArgumentParser.add_subparsers()
# which was added in in Python3.7.
# Must also be written into SubMenu.create_submenu.
func_args = {
'dest': param_name,
'metavar': param_name,
@ -469,12 +470,27 @@ class SubMenu:
help='sub-submenu help',
description='sub-sub description')
# NOTE(MG) Fix below strategizes whether to pass in 'required'
# paremter to ArgumentParser.add_subparsers()
# which was added in in Python3.7.
# Must also be written into SubMenu.create_submenu.
func_args = {
'dest': var_name,
'metavar': var_name,
'required': is_required
}
if (
sys.version_info.major == 3
and sys.version_info.minor <= 6
):
if is_required:
_bootstrap_logger.warn('Unable to enforce required submenu: Requires >= Python 3.7')
del func_args['required']
# Turn entry into a submenu of it's own:
# type = _SubParsersAction
subp_node = entry_node.add_subparsers(
dest = var_name,
metavar = var_name,
required = is_required)
**func_args
)
submenu = SubMenu(
self.parent,