Skip to content

Commit

Permalink
Fix regression in RHEL 8 / Python3.6 support. (#700)
Browse files Browse the repository at this point in the history
Check for python version to handle method signature change in argparse

Signed-off-by: ijnek <[email protected]>
Co-authored-by: Steven! Ragnarök <[email protected]>
  • Loading branch information
ijnek and nuclearsandwich authored Mar 29, 2024
1 parent 504bc68 commit b3e1b3a
Showing 1 changed file with 9 additions and 7 deletions.
16 changes: 9 additions & 7 deletions bloom/commands/generate.py
Original file line number Diff line number Diff line change
Expand Up @@ -58,13 +58,15 @@ def load_generator_description(generator_name):

def create_subparsers(parser, generator_cmds):
metavar = '[' + ' | '.join(generator_cmds) + ']'
subparsers = parser.add_subparsers(
title='generate commands',
metavar=metavar,
description='Call `bloom-generate {0} -h` for help on a each generate command.'.format(metavar),
dest='generator_cmd',
required=True
)
subparsers_kwargs = {
'title': 'generate commands',
'metavar': metavar,
'description': 'Call `bloom-generate {0} -h` for help on a each generate command.'.format(metavar),
'dest': 'generator_cmd'
}
if sys.version_info >= (3, 7):
subparsers_kwargs['required'] = True
subparsers = parser.add_subparsers(**subparsers_kwargs)
for generator_cmd in generator_cmds:
desc = load_generator_description(generator_cmd)
cmd_parser = subparsers.add_parser(desc['title'], description=desc['description'])
Expand Down

0 comments on commit b3e1b3a

Please sign in to comment.