You cannot select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
30 lines
604 B
Python
30 lines
604 B
Python
3 years ago
|
from __future__ import absolute_import, division, print_function
|
||
|
__metaclass__ = type
|
||
3 years ago
|
|
||
9 months ago
|
import re
|
||
3 years ago
|
|
||
|
import ansible
|
||
|
|
||
|
__all__ = [
|
||
|
'ansible_version',
|
||
|
]
|
||
|
|
||
9 months ago
|
|
||
|
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
|
||
3 years ago
|
del ansible
|