Skip to content

Commit

Permalink
in skare3_tools.packages.get_repository_info: sort releases using val…
Browse files Browse the repository at this point in the history
…id PEP 440 numbers
  • Loading branch information
javierggt committed Aug 22, 2023
1 parent 891d58e commit 5d035b2
Showing 1 changed file with 10 additions and 1 deletion.
11 changes: 10 additions & 1 deletion skare3_tools/packages.py
Original file line number Diff line number Diff line change
Expand Up @@ -84,6 +84,7 @@
import requests
import yaml

from packaging.version import Version
from skare3_tools import github
from skare3_tools.config import CONFIG

Expand Down Expand Up @@ -508,6 +509,13 @@ def _get_repository_info_v4(
release_shas = [r["release_sha"] for r in release_info[1:]]
for release in releases:
if release["tag_oid"] not in release_shas:
try:
Version(release["tagName"])
except InvalidVersion:
logging.debug(
f"Version {release['tagName']} does not conform to PEP 440 and will be ignored"
)
continue
release_info.append(
{
"release_sha": release["tag_oid"],
Expand All @@ -519,8 +527,9 @@ def _get_repository_info_v4(
}
)

# the first entry in the list is not a release, but the current main branch
release_info = release_info[:1] + sorted(
release_info[1:], key=lambda r: r["release_commit_date"], reverse=True
release_info[1:], key=lambda r: Version(r["release_tag"]), reverse=True
)

release_tags = [r["release_tag"] for r in release_info]
Expand Down

0 comments on commit 5d035b2

Please sign in to comment.