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:
kgottholm 2017-05-23 13:49:54 -04:00 committed by Toshio Kuratomi
commit 5240e5a230
4 changed files with 21 additions and 11 deletions

View file

@ -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. """