Prepare for distutils.version being removed in Python 3.12 (#3936)

* Prepare for distutils.version being removed in Python 2.12.

* Fix copy'n'paste error.

* Re-add Loose prefix.

* Fix Python version typos.

* Improve formulation.

* Move message into own line.

* Fix casing, now that the object is no longer called Version.
This commit is contained in:
Felix Fontein 2021-12-24 18:34:48 +01:00 committed by GitHub
parent f34c454412
commit a2f72be6c8
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
41 changed files with 106 additions and 63 deletions

View file

@ -140,7 +140,8 @@ EXAMPLES = '''
import os
import re
import tempfile
from distutils import version
from ansible_collections.community.general.plugins.module_utils.version import LooseVersion
from ansible.module_utils.common.text.converters import to_bytes
from ansible.module_utils.basic import AnsibleModule
@ -493,7 +494,7 @@ class HomebrewCask(object):
def _brew_cask_command_is_deprecated(self):
# The `brew cask` replacements were fully available in 2.6.0 (https://brew.sh/2020/12/01/homebrew-2.6.0/)
return version.LooseVersion(self._get_brew_version()) >= version.LooseVersion('2.6.0')
return LooseVersion(self._get_brew_version()) >= LooseVersion('2.6.0')
# /checks ------------------------------------------------------ }}}
# commands ----------------------------------------------------- {{{