ansible_mitogen: Remove use of distutils, which was removed in Python 3.12
This commit is contained in:
parent
92c00d913e
commit
fe8a3a71fc
|
@ -1,7 +1,7 @@
|
|||
from __future__ import absolute_import, division, print_function
|
||||
__metaclass__ = type
|
||||
|
||||
import distutils.version
|
||||
import re
|
||||
|
||||
import ansible
|
||||
|
||||
|
@ -9,6 +9,21 @@ __all__ = [
|
|||
'ansible_version',
|
||||
]
|
||||
|
||||
ansible_version = tuple(distutils.version.LooseVersion(ansible.__version__).version)
|
||||
del distutils
|
||||
|
||||
def _parse(v_string):
|
||||
# Adapted from distutils.version.LooseVersion.parse()
|
||||
component_re = re.compile(r'(\d+ | [a-z]+ | \.)', re.VERBOSE)
|
||||
for component in component_re.split(v_string):
|
||||
if not component or component == '.':
|
||||
continue
|
||||
try:
|
||||
yield int(component)
|
||||
except ValueError:
|
||||
yield component
|
||||
|
||||
|
||||
ansible_version = tuple(_parse(ansible.__version__))
|
||||
|
||||
del _parse
|
||||
del re
|
||||
del ansible
|
||||
|
|
Loading…
Reference in New Issue