diff options
author | Zane Bitter <zbitter@redhat.com> | 2018-07-18 16:33:41 -0400 |
---|---|---|
committer | Zane Bitter <zbitter@redhat.com> | 2018-07-18 16:33:41 -0400 |
commit | c583cbf9b25a8747b7eb2317c970acaecb9484f3 (patch) | |
tree | 91984ff881345849bde4b6909d8e102c091e449a | |
parent | eccdf10a9334069d9c11c323cee25e92090213fd (diff) | |
download | heat-cfntools-c583cbf9b25a8747b7eb2317c970acaecb9484f3.tar.gz |
Python3: Don't use cmp() function
The built-in cmp() function has been removed in Python 3, so don't try to
use it.
Change-Id: Ic62b7032ec6fd555974fc0d818327879d53a8ff2
-rw-r--r-- | heat_cfntools/cfntools/cfn_helper.py | 8 |
1 files changed, 6 insertions, 2 deletions
diff --git a/heat_cfntools/cfntools/cfn_helper.py b/heat_cfntools/cfntools/cfn_helper.py index f2b9f90..e68d8fe 100644 --- a/heat_cfntools/cfntools/cfn_helper.py +++ b/heat_cfntools/cfntools/cfn_helper.py @@ -457,13 +457,17 @@ class PackagesHandler(object): p1_name = pkg1[0] p2_name = pkg2[0] if p1_name in order and p2_name in order: - return cmp(order.index(p1_name), order.index(p2_name)) + i1 = order.index(p1_name) + i2 = order.index(p2_name) + return (i1 > i2) - (i1 < i2) elif p1_name in order: return -1 elif p2_name in order: return 1 else: - return cmp(p1_name.lower(), p2_name.lower()) + n1 = p1_name.lower() + n2 = p2_name.lower() + return (n1 > n2) - (n1 < n2) def __init__(self, packages): self._packages = packages |