mirror of
https://gitlab.com/fdroid/fdroidserver.git
synced 2024-11-04 14:30:11 +01:00
stats: write known apks in natural order
By using natural instead of alphabetical sorting, we support sorting by vercodes properly and thus app versions show in the correct order.
This commit is contained in:
parent
f4cbb6b3f8
commit
05316e3292
@ -1654,6 +1654,10 @@ def scan_source(build_dir, root_dir, thisbuild):
|
|||||||
return count
|
return count
|
||||||
|
|
||||||
|
|
||||||
|
def natural_key(s):
|
||||||
|
return [int(sp) if sp.isdigit() else sp for sp in re.split(r'(\d+)', s)]
|
||||||
|
|
||||||
|
|
||||||
class KnownApks:
|
class KnownApks:
|
||||||
|
|
||||||
def __init__(self):
|
def __init__(self):
|
||||||
@ -1684,7 +1688,7 @@ class KnownApks:
|
|||||||
lst.append(line)
|
lst.append(line)
|
||||||
|
|
||||||
with open(self.path, 'w') as f:
|
with open(self.path, 'w') as f:
|
||||||
for line in sorted(lst):
|
for line in sorted(lst, key=natural_key):
|
||||||
f.write(line + '\n')
|
f.write(line + '\n')
|
||||||
|
|
||||||
# Record an apk (if it's new, otherwise does nothing)
|
# Record an apk (if it's new, otherwise does nothing)
|
||||||
|
Loading…
Reference in New Issue
Block a user