Blame SOURCES/0011-Python3-Don-t-use-cmp-function.patch

a64660
From c583cbf9b25a8747b7eb2317c970acaecb9484f3 Mon Sep 17 00:00:00 2001
a64660
From: Zane Bitter <zbitter@redhat.com>
a64660
Date: Wed, 18 Jul 2018 16:33:41 -0400
a64660
Subject: [PATCH 11/21] Python3: Don't use cmp() function
a64660
a64660
The built-in cmp() function has been removed in Python 3, so don't try to
a64660
use it.
a64660
a64660
Change-Id: Ic62b7032ec6fd555974fc0d818327879d53a8ff2
a64660
---
a64660
 heat_cfntools/cfntools/cfn_helper.py | 8 ++++++--
a64660
 1 file changed, 6 insertions(+), 2 deletions(-)
a64660
a64660
diff --git a/heat_cfntools/cfntools/cfn_helper.py b/heat_cfntools/cfntools/cfn_helper.py
a64660
index f2b9f90..e68d8fe 100644
a64660
--- a/heat_cfntools/cfntools/cfn_helper.py
a64660
+++ b/heat_cfntools/cfntools/cfn_helper.py
a64660
@@ -457,13 +457,17 @@ class PackagesHandler(object):
a64660
         p1_name = pkg1[0]
a64660
         p2_name = pkg2[0]
a64660
         if p1_name in order and p2_name in order:
a64660
-            return cmp(order.index(p1_name), order.index(p2_name))
a64660
+            i1 = order.index(p1_name)
a64660
+            i2 = order.index(p2_name)
a64660
+            return (i1 > i2) - (i1 < i2)
a64660
         elif p1_name in order:
a64660
             return -1
a64660
         elif p2_name in order:
a64660
             return 1
a64660
         else:
a64660
-            return cmp(p1_name.lower(), p2_name.lower())
a64660
+            n1 = p1_name.lower()
a64660
+            n2 = p2_name.lower()
a64660
+            return (n1 > n2) - (n1 < n2)
a64660
 
a64660
     def __init__(self, packages):
a64660
         self._packages = packages
a64660
-- 
a64660
2.20.1
a64660