2022-04-23 08:27:14 +00:00
|
|
|
from __future__ import absolute_import, division, print_function
|
|
|
|
__metaclass__ = type
|
2021-11-20 22:54:45 +00:00
|
|
|
|
2024-03-06 11:07:45 +00:00
|
|
|
import re
|
2021-11-20 22:54:45 +00:00
|
|
|
|
|
|
|
import ansible
|
|
|
|
|
|
|
|
__all__ = [
|
|
|
|
'ansible_version',
|
|
|
|
]
|
|
|
|
|
2024-03-06 11:07:45 +00:00
|
|
|
|
|
|
|
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
|
2021-11-20 22:54:45 +00:00
|
|
|
del ansible
|