def is_version_gte(actual, expected):
""" Checks two versions for actual >= epected condition
Versions need to be in Major.Minor.Patch format.
Args:
actual (str): the actual version being checked
expected (str): the expected version being checked
Returns:
bool: True if the actual version is greater than or equal to
the expected version.
Raises:
ValueError: if expected ot actual version is not in Major.Minor.Patch
format.
"""
if isinstance(parse_version(actual), SetuptoolsVersion):
# This handles versions that end in things like `rc0`
return parse_version(actual) >= parse_version(expected)
else:
# This handles versions that end in things like `-v7+` and `-generic`
return LooseVersion(actual) >= LooseVersion(expected)
评论列表
文章目录