Compare software package versions

    Args:
        ver1 (str): A software version to compare
        oper (str): The operand to use to compare
        ver2 (str): A software version to compare

    Returns:
        bool: True if the comparison is valid, otherwise False

    CLI Example:

    .. code-block:: bash

        salt '*' pkg.compare_versions 1.2 >= 1.3

def compare_versions(ver1='', oper='==', ver2=''):
    '''
    Compare software package versions

    Args:
        ver1 (str): A software version to compare
        oper (str): The operand to use to compare
        ver2 (str): A software version to compare

    Returns:
        bool: True if the comparison is valid, otherwise False

    CLI Example:

    .. code-block:: bash

        salt '*' pkg.compare_versions 1.2 >= 1.3
    '''
    if not ver1:
        raise SaltInvocationError('compare_version, ver1 is blank')
    if not ver2:
        raise SaltInvocationError('compare_version, ver2 is blank')

    # Support version being the special meaning of 'latest'
    if ver1 == 'latest':
        ver1 = six.text_type(sys.maxsize)
    if ver2 == 'latest':
        ver2 = six.text_type(sys.maxsize)
    # Support version being the special meaning of 'Not Found'
    if ver1 == 'Not Found':
        ver1 = '0.0.0.0.0'
    if ver2 == 'Not Found':
        ver2 = '0.0.0.0.0'

    return salt.utils.versions.compare(ver1, oper, ver2, ignore_epoch=True)