Skip to content

Commit

Permalink
use prerelease aware version comparison
Browse files Browse the repository at this point in the history
  • Loading branch information
briantist committed Sep 29, 2023
1 parent 09d3b93 commit 7aeabb1
Showing 1 changed file with 6 additions and 9 deletions.
15 changes: 6 additions & 9 deletions galactory/utilities.py
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand Down

0 comments on commit 7aeabb1

Please sign in to comment.