1
0
mirror of https://github.com/openSUSE/osc.git synced 2025-02-27 20:52:14 +01:00

Merge pull request #530 from lethliel/fix_search_sorting_bsc1129757

[python3] fix sorting when using osc se
This commit is contained in:
Marco Strigl 2019-04-16 15:38:40 +02:00 committed by GitHub
commit 202c50be3e
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -34,6 +34,8 @@ try:
except ImportError: except ImportError:
from .util.helper import cmp_to_key from .util.helper import cmp_to_key
from operator import itemgetter
MAN_HEADER = r""".TH %(ucname)s "1" "%(date)s" "%(name)s %(version)s" "User Commands" MAN_HEADER = r""".TH %(ucname)s "1" "%(date)s" "%(name)s %(version)s" "User Commands"
.SH NAME .SH NAME
%(name)s \- openSUSE build service command-line tool. %(name)s \- openSUSE build service command-line tool.
@ -7741,11 +7743,12 @@ Please submit there instead, or use --nodevelproject to force direct submission.
continue continue
# construct a sorted, flat list # construct a sorted, flat list
# Sort by first column, follwed by second column if we have two columns, else sort by first. # Sort by first column, follwed by second column if we have two columns, else sort by first.
# results.sort(lambda x, y: ( cmp(x[0], y[0]) or if len(results[0]) > 1:
# (len(x)>1 and len(y)>1 and cmp(x[1], y[1])) )) sorted_results = sorted(results, key=itemgetter(0,1))
results.sort(key=cmp_to_key(compare)) else:
sorted_results = sorted(results, key=itemgetter(0))
new = [] new = []
for i in results: for i in sorted_results:
new.extend(i) new.extend(i)
results = new results = new
headline = [] headline = []