From 7aeabb12eab85ec985955f4ef2ee828b28b13632 Mon Sep 17 00:00:00 2001 From: Brian Scholer <1260690+briantist@users.noreply.github.com> Date: Fri, 29 Sep 2023 17:02:02 -0400 Subject: [PATCH] use prerelease aware version comparison --- galactory/utilities.py | 15 ++++++--------- 1 file changed, 6 insertions(+), 9 deletions(-) diff --git a/galactory/utilities.py b/galactory/utilities.py index 8a993a1..2d96bc8 100644 --- a/galactory/utilities.py +++ b/galactory/utilities.py @@ -158,18 +158,15 @@ def collected_collections(repo, namespace=None, name=None, scheme=None): for c in discover_collections(repo, namespace=namespace, name=name, scheme=scheme): version = c['version'] - ver = c['semver'] col = collections.setdefault(c['fqcn'], {}) versions = col.setdefault('versions', {}) versions[version] = c - if not ver.prerelease: - try: - latest = col['latest'] - except KeyError: - col['latest'] = c - else: - if ver > latest['semver']: - col['latest'] = c + try: + latest = col['latest'] + except KeyError: + col['latest'] = c + else: + col['latest'] = _latest_collection_version(latest, c) return collections