]> TLD Linux GIT Repositories - tld-builder.git/commitdiff
- substitute cmp for python3
authorMarcin Krol <hawk@tld-linux.org>
Sun, 2 May 2021 13:13:14 +0000 (15:13 +0200)
committerMarcin Krol <hawk@tld-linux.org>
Sun, 2 May 2021 13:13:14 +0000 (15:13 +0200)
TLD_Builder/file_sender.py
TLD_Builder/load_balancer.py
TLD_Builder/rpm_builder.py
TLD_Builder/srpm_builder.py
TLD_Builder/util.py

index 056045826204a5a0a3646a98bb4d184187343a57..b28980ee764fa3567e96faff6920c6af7321ce30 100644 (file)
@@ -163,9 +163,9 @@ def flush_queue(dir):
         d = read_name_val(f)
         if d != None: q.append(d)
     def mycmp(x, y):
-        rc = cmp(x['Time'], y['Time'])
+        rc = util.cmp(x['Time'], y['Time'])
         if rc == 0 and 'Type' in x and 'Type' in y:
-            return cmp(x['Type'], y['Type'])
+            return util.cmp(x['Type'], y['Type'])
         else:
             return rc
     q.sort(key=util.cmp_to_key(mycmp))
index 43d85d56dc2ab4e503e1a3f58960351247d66abd..459034b7970f77697d6c3fbe90422cfd40f0ffec 100644 (file)
@@ -39,7 +39,7 @@ def builders_order():
             log.alert("found strange lock in got-lock: %s" % b)
 
     def mycmp(b1, b2):
-        return cmp(bs[b1], bs[b2])
+        return util.cmp(bs[b1], bs[b2])
 
     bl.sort(key=util.cmp_to_key(mycmp))
 
index 65ab8e21513653a3415a4960d0da1a87f9be6592..666f7d6744134dfb2153c63a03a774c58149291a 100644 (file)
@@ -45,9 +45,9 @@ def pick_request(q):
     def mycmp(r1, r2):
         if r1.kind != 'group' or r2.kind != 'group':
             raise Exception("non-group requests")
-        pri_diff = cmp(r1.priority, r2.priority)
+        pri_diff = util.cmp(r1.priority, r2.priority)
         if pri_diff == 0:
-            return cmp(r1.time, r2.time)
+            return util.cmp(r1.time, r2.time)
         else:
             return pri_diff
     q.requests.sort(key=util.cmp_to_key(mycmp))
index 510b1f7e58bf2702afc98d3e3d91255f6e918a01..d76146697ff9dc0f300160ac3571d70274d964f0 100644 (file)
@@ -33,9 +33,9 @@ def pick_request(q):
     def mycmp(r1, r2):
         if r1.kind != 'group' or r2.kind != 'group':
             raise Exception("non-group requests")
-        pri_diff = cmp(r1.priority, r2.priority)
+        pri_diff = util.cmp(r1.priority, r2.priority)
         if pri_diff == 0:
-            return cmp(r1.time, r2.time)
+            return util.cmp(r1.time, r2.time)
         else:
             return pri_diff
     q.requests.sort(key=util.cmp_to_key(mycmp))
index b6bcc2460ff2053fc5494f72e3c6215b6efcbc78..602bad176fe9e4ba01c6d7f4344bd235dc0c2ae2 100644 (file)
@@ -112,3 +112,6 @@ def to_str(s):
         return s
     else:
         raise TypeError("Expected bytes or string, but got %s." % type(s))
+
+def cmp(a, b):
+    return (a > b) - (a < b)