From 2d0c974296884c63aac859ab65d6334ec3bfc38d Mon Sep 17 00:00:00 2001 From: Marcus Huewe Date: Sun, 27 Jan 2019 16:12:57 +0100 Subject: [PATCH] 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 (see PR#483 [1]). [1] https://github.com/openSUSE/osc/pull/483 --- osc/util/packagequery.py | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/osc/util/packagequery.py b/osc/util/packagequery.py index 03a84e49..e4307447 100644 --- a/osc/util/packagequery.py +++ b/osc/util/packagequery.py @@ -159,6 +159,11 @@ class PackageQueryResult: evr = epoch + ":" + evr return evr + +def cmp(a, b): + return (a > b) - (a < b) + + if __name__ == '__main__': import sys try: