Skip to content

Commit

Permalink
Unvendor distutils.version.
Browse files Browse the repository at this point in the history
  • Loading branch information
felixfontein committed Jan 8, 2022
1 parent 77a930c commit cf493b6
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 348 deletions.
2 changes: 2 additions & 0 deletions changelogs/fragments/3988-distutils-vendor-removed.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
minor_changes:
- "Remove vendored copy of ``distutils.version`` in favor of vendored copy included with ansible-core 2.12+. For ansible-core 2.11, uses ``distutils.version`` for Python < 3.12. There is no support for ansible-core 2.11 with Python 3.12+ (https://github.com/ansible-collections/community.general/pull/3988)."
343 changes: 0 additions & 343 deletions plugins/module_utils/_version.py

This file was deleted.

14 changes: 9 additions & 5 deletions plugins/module_utils/version.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,9 +9,13 @@
__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)

0 comments on commit cf493b6

Please sign in to comment.