wafsamba: Fix call to sorted()
authorJoseph Sutton <josephsutton@catalyst.net.nz>
Tue, 15 Feb 2022 07:05:55 +0000 (20:05 +1300)
committerAndrew Bartlett <abartlet@samba.org>
Thu, 17 Mar 2022 01:36:59 +0000 (01:36 +0000)
In Python 3, sorted() does not take a 'cmp' parameter, so we need to use
the 'key' parameter instead.

Signed-off-by: Joseph Sutton <josephsutton@catalyst.net.nz>
Reviewed-by: Andrew Bartlett <abartlet@samba.org>
Autobuild-User(master): Andrew Bartlett <abartlet@samba.org>
Autobuild-Date(master): Thu Mar 17 01:36:59 UTC 2022 on sn-devel-184

buildtools/wafsamba/samba_deps.py

index 9c922f7e036c3f876d683117e8780f14049bc315..c0a330b1b5e5994229c5b35734c4f2c62b05f730 100644 (file)
@@ -1023,10 +1023,10 @@ def show_object_duplicates(bld, tgt_list):
 
     Logs.info("showing indirect dependency counts (sorted by count)")
 
-    def indirect_count(t1, t2):
-        return len(t2.indirect_objects) - len(t1.indirect_objects)
+    def indirect_count(t):
+        return len(t.indirect_objects)
 
-    sorted_list = sorted(tgt_list, cmp=indirect_count)
+    sorted_list = sorted(tgt_list, key=indirect_count, reverse=True)
     for t in sorted_list:
         if len(t.indirect_objects) > 1:
             Logs.info("%s depends on %u indirect objects" % (t.sname, len(t.indirect_objects)))