mirror of
https://github.com/ansible-collections/community.general.git
synced 2025-07-22 21:00:22 -07:00
Vertica schema fix (#24915)
* replace deprecated cmp() with custom conditional cmp is not present in Python3 but several modules use it Reference 24756
This commit is contained in:
parent
9cd6f1bf91
commit
5240e5a230
4 changed files with 21 additions and 11 deletions
|
@ -88,7 +88,16 @@ def compare_package(version1, version2):
|
|||
|
||||
def normalize(v):
|
||||
return [int(x) for x in re.sub(r'(\.0+)*$', '', v).split(".")]
|
||||
return cmp(normalize(version1), normalize(version2))
|
||||
normalized_version1 = normalize(version1)
|
||||
normalized_version2 = normalize(version2)
|
||||
if normalized_version1 == normalized_version2:
|
||||
rc = 0
|
||||
elif normalized_version1 < normalized_version2:
|
||||
rc = -1
|
||||
else:
|
||||
rc = 1
|
||||
return rc
|
||||
|
||||
|
||||
def query_package(module, name, depot=None):
|
||||
""" Returns whether a package is installed or not and version. """
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue