-
Notifications
You must be signed in to change notification settings - Fork 339
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Prepare for distutils.version being removed in Python 3.12 #1165
Conversation
distutils has been deprecafed and will be removed from Python's stdlib in Python 3.12 (see https://python.org/dev/peps/pep-0632). This PR replaces the use of distutils.version.LooseVersion and distutils.version.StrictVersion with LooseVersion from the vendored copy of distutils.version included with ansible-core 2.12 (ansible/ansible#74644) if available, and falls back to distutils.version for ansible-core 2.11 and before. Since ansible-core 2.11 and earlier do not support Python 3.12 (since they use LooseVersion itself in various places), this incomplete fix should be OK for now. Also, the way this PR works (by adding a new module_utils version that abstracts away where LooseVersion comes from), it is easy to also fix this for ansible-core 2.11 and earlier later on. Signed-off-by: Abhijeet Kasurde <[email protected]>
Co-authored-by: Felix Fontein <[email protected]>
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@Akasurde ansible-tox-linters fais because plugins/module_utils/version.py
imports distutils.version.LooseVersion
but doesn't use it. Can you please have a look and fix this?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This should shut the linter up:
Co-authored-by: Felix Fontein <[email protected]>
Co-authored-by: Felix Fontein <[email protected]>
recheck |
recheck |
recheck |
@goneri Do you know why the last 4 CI jobs keep failing? I don't really understand this:
|
Thx @felixfontein, it looks like it did! We still have some checks that fail, but I think this is a CI issue and has nothing to do with this PR. |
recheck |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM
recheck |
@mariolenz I keep an eye on the CI jobs. For the record, you can ignore the softwarefactory jobs for now. It's still experimental at this stage. |
hum, looks like there is several problems at the same time :-(. I will take a look when I'm back from PTO. |
recheck |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM!
FYI: I've added the the Enjoy your PTO! |
Please consider creating a follow-up PR based on ansible-collections/community.general#3984. |
Prepare for distutils.version being removed in Python 3.12 SUMMARY This is a follow-up PR to #1165 and replaces the use of distutils.version.StrictVersion with ansible.module_utils.compat.version.StrictVersion. ISSUE TYPE Bugfix Pull Request COMPONENT NAME plugins/module_utils/version.py plugins/module_utils/vmware.py ADDITIONAL INFORMATION distutils has been deprecated and will be removed from Python's stdlib in Python 3.12 (see PEP 632). Also, see here and the following comments.
SUMMARY
distutils has been deprecafed and will be removed from
Python's stdlib in Python 3.12 (see https://python.org/dev/peps/pep-0632).
This PR replaces the use of distutils.version.LooseVersion and distutils.version.StrictVersion
with LooseVersion from the vendored copy of distutils.version
included with ansible-core 2.12 (ansible/ansible#74644) if available,
and falls back to distutils.version for ansible-core 2.11 and before.
Since ansible-core 2.11 and earlier do not support Python 3.12 (since
they use LooseVersion itself in various places), this incomplete fix
should be OK for now. Also, the way this PR works (by adding a new
module_utils version that abstracts away where LooseVersion comes from),
it is easy to also fix this for ansible-core 2.11 and earlier later on.
Signed-off-by: Abhijeet Kasurde [email protected]
ISSUE TYPE
COMPONENT NAME
changelogs/fragments/disutils.version.yml
plugins/module_utils/version.py
plugins/modules/vmware_category.py
plugins/modules/vmware_vc_infraprofile_info.py