[stable-2.8] Use LooseVersion instead of StrictVersion as StrictVersion doesn't understand "rc1"

(cherry picked from commit b71133e)

Co-authored-by: Toshio Kuratomi <a.badger@gmail.com>
This commit is contained in:
Toshio Kuratomi 2019-04-25 09:22:32 -07:00
parent ebaf42bbbe
commit 104f39a41d

View file

@ -4,7 +4,7 @@
from __future__ import (absolute_import, division, print_function) from __future__ import (absolute_import, division, print_function)
__metaclass__ = type __metaclass__ = type
from distutils.version import StrictVersion from distutils.version import LooseVersion
import astroid import astroid
@ -35,7 +35,7 @@ MSGS = {
} }
ANSIBLE_VERSION = StrictVersion('.'.join(ansible_version_raw.split('.')[:3])) ANSIBLE_VERSION = LooseVersion('.'.join(ansible_version_raw.split('.')[:3]))
def _get_expr_name(node): def _get_expr_name(node):
@ -83,7 +83,7 @@ class AnsibleDeprecatedChecker(BaseChecker):
return return
try: try:
if ANSIBLE_VERSION >= StrictVersion(str(version)): if ANSIBLE_VERSION >= LooseVersion(str(version)):
self.add_message('ansible-deprecated-version', node=node, args=(version,)) self.add_message('ansible-deprecated-version', node=node, args=(version,))
except ValueError: except ValueError:
self.add_message('ansible-invalid-deprecated-version', node=node, args=(version,)) self.add_message('ansible-invalid-deprecated-version', node=node, args=(version,))