2021-12-24 18:34:48 +01:00
|
|
|
# -*- coding: utf-8 -*-
|
|
|
|
|
2022-08-05 12:28:29 +02:00
|
|
|
# Copyright (c) 2021, Felix Fontein <felix@fontein.de>
|
|
|
|
# GNU General Public License v3.0+ (see LICENSES/GPL-3.0-or-later.txt or https://www.gnu.org/licenses/gpl-3.0.txt)
|
|
|
|
# SPDX-License-Identifier: GPL-3.0-or-later
|
2021-12-24 18:34:48 +01:00
|
|
|
|
|
|
|
"""Provide version object to compare version numbers."""
|
|
|
|
|
|
|
|
from __future__ import absolute_import, division, print_function
|
|
|
|
__metaclass__ = type
|
|
|
|
|
|
|
|
|
2022-01-08 21:45:02 +01:00
|
|
|
from ansible.module_utils.six import raise_from
|
2022-01-05 21:19:49 +01:00
|
|
|
|
2022-01-08 21:45:02 +01:00
|
|
|
try:
|
2023-02-12 19:48:39 +01:00
|
|
|
from ansible.module_utils.compat.version import LooseVersion # noqa: F401, pylint: disable=unused-import
|
2022-01-08 21:45:02 +01:00
|
|
|
except ImportError:
|
|
|
|
try:
|
2023-02-12 19:48:39 +01:00
|
|
|
from distutils.version import LooseVersion # noqa: F401, pylint: disable=unused-import
|
2022-01-08 21:45:02 +01:00
|
|
|
except ImportError as exc:
|
|
|
|
msg = 'To use this plugin or module with ansible-core 2.11, you need to use Python < 3.12 with distutils.version present'
|
|
|
|
raise_from(ImportError(msg), exc)
|