Skip to content

Commit

Permalink
Unvendor distutils.version (#3988)
Browse files Browse the repository at this point in the history
* Unvendor distutils.version.

* Document breaking change.
  • Loading branch information
felixfontein authored Jan 8, 2022
1 parent ebc0ef8 commit 29e8f5f
Show file tree
Hide file tree
Showing 4 changed files with 15 additions and 348 deletions.
2 changes: 2 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,8 @@ If you encounter abusive behavior violating the [Ansible Code of Conduct](https:

Tested with the current Ansible 2.9, ansible-base 2.10, ansible-core 2.11, ansible-core 2.12 releases and the current development version of ansible-core. Ansible versions before 2.9.10 are not supported.

Parts of this collection do not work with ansible-core before 2.12 (this includes ansible-base and Ansible 2.9) on Python 2.12+.

## External requirements

Some modules and plugins require external libraries. Please check the requirements for each plugin or module you use in the documentation to find out which requirements are needed.
Expand Down
4 changes: 4 additions & 0 deletions changelogs/fragments/3988-distutils-vendor-removed.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
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)."
breaking_changes:
- "Parts of this collection do not work with ansible-core 2.11 on Python 3.12+. Please either upgrade to ansible-core 2.12+, or use Python 3.11 or earlier (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 29e8f5f

Please sign in to comment.