Skip to content

Commit be2261e

Browse files
authored
fix: Show highest versions first (reverse-sort versions) (#296)
1 parent db8c578 commit be2261e

File tree

1 file changed

+5
-2
lines changed

1 file changed

+5
-2
lines changed

tools/indexer.py

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -109,8 +109,11 @@ def __init__(self, id, installers, screenshots):
109109
versions = collections.defaultdict(list)
110110
for installer in installers:
111111
versions[installer['version']].append(installer)
112-
# We use `natsort` to sort the versions to ensure, for example, 10.0 sorts _after_ 2.0.
113-
self.versions = natsort.natsorted([Version(installers=installers) for installers in versions.values()], key=lambda x: x.version)
112+
# We use `natsort` to sort the versions to ensure, for example, 10.0 sorts after 2.0.
113+
# Note: 'Unknown' is sorted as '0' to ensure it orders before all others. This is a pretty miserable hack and
114+
# should be replaced when we plumb through major and minor integer versions.
115+
self.versions = list(reversed(natsort.natsorted([Version(installers=installers) for installers in versions.values()],
116+
key=lambda x: x.version if x.version != "Unknown" else "0")))
114117
self.tags = set(functools.reduce(operator.iconcat, [installer['tags'] for installer in installers], []))
115118
self.runtimes = set(functools.reduce(operator.iconcat, [installer['runtimes'] for installer in installers], []))
116119
self.kinds = set([installer['kind'] for installer in installers])

0 commit comments

Comments
 (0)