Py3: Replace cmp usage by its equivalent.
authorDidier Raboud <odyx@debian.org>
Wed, 23 May 2012 09:30:47 +0000 (11:30 +0200)
committerDidier Raboud <odyx@debian.org>
Wed, 23 May 2012 12:56:48 +0000 (14:56 +0200)
lsb_release.py
test/test_lsb_release.py

index 68664e66a5322cc2e10e394abb97a8213a90081b..eb3c45a3c8cf0f3ddd2c8266325e9ecd85732cf4 100644 (file)
@@ -185,7 +185,7 @@ def compare_release(x, y):
         if suite_x in RELEASES_ORDER and suite_y in RELEASES_ORDER:
             return RELEASES_ORDER.index(suite_y)-RELEASES_ORDER.index(suite_x)
         else:
-            return cmp(suite_x, suite_y)
+            return (suite_x > suite_y) - (suite_x < suite_y)
 
     return 0
 
index 7e85769615a642f18574b4bd337ce80c719ef50d..d095664aa41764d5b4c41fad29f90d35017ffb33 100644 (file)
@@ -123,7 +123,7 @@ class TestLSBRelease(unittest.TestCase):
                # Test that sequences not in RELEASES_ORDER lead to reliable output
                x[1]['suite'] = rnd_string(1,12)
                y[1]['suite'] = rnd_string(1,12)
-               supposed_output = cmp(x[1]['suite'],y[1]['suite'])
+               supposed_output = (x[1]['suite'] > y[1]['suite']) - (x[1]['suite'] < y[1]['suite'])
                self.assertEqual(lr.compare_release(x,y),
                                 supposed_output,
                                 'compare_release(' + x[1]['suite'] + ',' + y[1]['suite'] + ') =? ' + str(supposed_output))