ansible-repo/mitogen-0.3.9/ansible_mitogen/utils/__init__.py
hogweed1 fe33aee2fe
Some checks reported errors
continuous-integration/drone/push Build encountered an error
w8 wut
2024-10-22 16:16:43 +10:00

30 lines
604 B
Python

from __future__ import absolute_import, division, print_function
__metaclass__ = type
import re
import ansible
__all__ = [
'ansible_version',
]
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