Unvendor distutils.version (#3988)

* Unvendor distutils.version.

* Document breaking change.
This commit is contained in:
Felix Fontein 2022-01-08 21:45:02 +01:00 committed by GitHub
parent ebc0ef882a
commit 29e8f5f8cf
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
4 changed files with 15 additions and 348 deletions

View file

@ -9,9 +9,13 @@ from __future__ import absolute_import, division, print_function
__metaclass__ = type
# Once we drop support for Ansible 2.9, ansible-base 2.10, and ansible-core 2.11, we can
# remove the _version.py file, and replace the following import by
#
# from ansible.module_utils.compat.version import LooseVersion
from ansible.module_utils.six import raise_from
from ._version import LooseVersion
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)