make sphinxext support eol tags

Fix the sorting for EOL tags so when we collapse the release history
of a project to show it on the web site the sort works.

Also skip over the EOL tags when determining the "latest" release from
the branch. They are still displayed as part of the full tag history.

Change-Id: Iedde30f65bdfa89db0c6697ff031a75350090892
Signed-off-by: Doug Hellmann <doug@doughellmann.com>
This commit is contained in:
Doug Hellmann 2018-06-14 17:04:47 -04:00
parent a0c983e0b8
commit b3d408541a
2 changed files with 11 additions and 1 deletions

View File

@ -62,6 +62,11 @@ def _safe_semver(v):
def _version_sort_key(release):
"""Return a value we can compare for sorting.
"""
# NOTE(dhellmann): We want EOL tags to sort last. This assumes we
# won't have more than 1000 major releases of anything, and I
# surely hope that is a safe assumption.
if release['version'].endswith('-eol'):
return _safe_semver('1000.0.0')
return _safe_semver(release['version'])

View File

@ -215,7 +215,12 @@ class DeliverableDirectiveBase(rst.Directive):
most_recent = []
for deliv in deliverables:
earliest_version = deliv.earliest_release
recent_version = deliv.latest_release
# Determine the most recent release that is not an EOL
# tag.
for r in reversed(deliv.releases):
if not r.is_eol:
recent_version = r.version
break
ref = ':ref:`%s-%s`' % (series, deliv.name)
release_notes = deliv.release_notes
if not release_notes: