Use vendored copy of distutils.version. (#369) (#370)

(cherry picked from commit 46f39efc43)

Co-authored-by: Felix Fontein <felix@fontein.de>
This commit is contained in:
patchback[bot]
2022-01-05 22:22:25 +01:00
committed by GitHub
parent b584336b62
commit 74e4be139f
3 changed files with 350 additions and 10 deletions

View File

@@ -8,13 +8,10 @@
from __future__ import absolute_import, division, print_function
__metaclass__ = type
from ansible.module_utils.six import raise_from
try:
from ansible.module_utils.compat.version import LooseVersion
except ImportError:
try:
from distutils.version import LooseVersion
except ImportError as exc:
msg = 'To use this plugin or module with ansible-core < 2.11, you need to use Python < 3.12 with distutils.version present'
raise_from(ImportError(msg), exc)
# Once we drop support for Ansible 2.9 and ansible-base 2.10, we can
# remove the _version.py file, and replace the following import by
#
# from ansible.module_utils.compat.version import LooseVersion
from ._version import LooseVersion