Handle backward compatibility for Cliff 2.16.0 (stable/train)
In stable/train Cliff version is 2.16.0 which force us to pin validations-libs or to handle backward compat directly in the code. For long term solution and to avoid tagging, pinning and complex release management this review fix the compatibility with Cliff 2.16.0 Change-Id: I6dec4c154f088e8cc6450d5d9cf2f9b407fdefdc
This commit is contained in:
parent
26bea93d28
commit
357697d0fb
@ -19,6 +19,12 @@ from cliff import _argparse
|
||||
from cliff.command import Command
|
||||
from cliff.lister import Lister
|
||||
|
||||
# Handle backward compatibility for Cliff 2.16.0 in stable/train:
|
||||
if hasattr(_argparse, 'SmartHelpFormatter'):
|
||||
from cliff._argparse import SmartHelpFormatter
|
||||
else:
|
||||
from cliff.command import _SmartHelpFormatter as SmartHelpFormatter
|
||||
|
||||
|
||||
class BaseCommand(Command):
|
||||
"""Base Command client implementation class"""
|
||||
@ -29,7 +35,7 @@ class BaseCommand(Command):
|
||||
description=self.get_description(),
|
||||
epilog=self.get_epilog(),
|
||||
prog=prog_name,
|
||||
formatter_class=_argparse.SmartHelpFormatter,
|
||||
formatter_class=SmartHelpFormatter,
|
||||
conflict_handler='resolve',
|
||||
)
|
||||
for hook in self._hooks:
|
||||
@ -47,7 +53,7 @@ class BaseLister(Lister):
|
||||
description=self.get_description(),
|
||||
epilog=self.get_epilog(),
|
||||
prog=prog_name,
|
||||
formatter_class=_argparse.SmartHelpFormatter,
|
||||
formatter_class=SmartHelpFormatter,
|
||||
conflict_handler='resolve',
|
||||
)
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user