1
0
mirror of https://github.com/openSUSE/osc.git synced 2025-02-26 12:12:11 +01:00

Add cmp function to packagequery module

cmp(a, b) returns
-1 if a < b
 0 if a == 0
 1 if a > b

This is needed since python3 has no cmp function anymore.

All credits for this go to Marco Strigl <mstrigl@suse.com> (see
PR#483 [1]).

[1] https://github.com/openSUSE/osc/pull/483
This commit is contained in:
Marcus Huewe 2019-01-27 16:12:57 +01:00
parent a3720c5286
commit 2d0c974296

View File

@ -159,6 +159,11 @@ class PackageQueryResult:
evr = epoch + ":" + evr evr = epoch + ":" + evr
return evr return evr
def cmp(a, b):
return (a > b) - (a < b)
if __name__ == '__main__': if __name__ == '__main__':
import sys import sys
try: try: