python/samba: Add cmp_fn and cmp_to_key_fn functions for py2/py3
commit0e930dfb477b121b69351cc9a011dfb71bcd10c0
authorNoel Power <noel.power@suse.com>
Fri, 15 Jun 2018 12:00:15 +0000 (15 13:00 +0100)
committerAndrew Bartlett <abartlet@samba.org>
Thu, 12 Jul 2018 23:12:25 +0000 (13 01:12 +0200)
treeb7ef3251e420ba5992dd2a1ad18924fc7e6550b8
parent06d3eac8a1f74b2954f6ca01a8ee3c33c23f1df5
python/samba: Add cmp_fn and cmp_to_key_fn functions for py2/py3

the cmp function and the cmp paramater (e.g. to sort functions)
no longer exist in python3.

cmp_fn is provides the missing functionality of the py2 cmp builtin
function.

cmp_to_key_fn allows the key paramater (e.g. for sort) to use the
old py2 cmp function for sorting. Note: the cmp_to_key is present in
since 2.7 (hence the inclusion of the source code for this function pre
that version)

Signed-off-by: Noel Power <noel.power@suse.com>
Reviewed-by: Douglas Bagnall <douglas.bagnall@catalyst.net.nz>
Reviewed-by: Andreas Schneider <asn@samba.org>
Signed-off-by: Joe Guo <joeg@catalyst.net.nz>
python/samba/compat.py