Skip to content
Draft
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
20 changes: 20 additions & 0 deletions docs/scripts/release/conf.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,8 @@
- the site base URL used for the sitemap
- the version switcher.

It also removes the "has not been released yet" note from the upgrade guide.

Why?

Documentation from older release tags do not have the version picker code and
Expand All @@ -27,6 +29,7 @@

import os
from pathlib import Path
import re
import sys

source = Path(os.environ["DATAFUSION_DOCS_SOURCE"]).resolve()
Expand Down Expand Up @@ -74,10 +77,27 @@ def generate_nav_html(kind, startdepth=1, **kwargs):
context.setdefault("generate_nav_html", generate_nav_html)


# Release tags are created with the upgrade guide still saying the release
# "has not been released yet". Releases before 53.0.0 follow that note with a
# link to the release tracking issue.
_UNRELEASED_NOTE = re.compile(
r"^\*\*Note:\*\* DataFusion `[^`]+` has not been released yet\."
r".*?(?:\n[ \t]*\n|\Z)"
r"(?:You can see the current \[status of .*?(?:\n[ \t]*\n|\Z))?",
re.MULTILINE | re.DOTALL,
)


def _remove_unreleased_note(app, docname, source):
if docname.startswith("library-user-guide/upgrading"):
source[0] = _UNRELEASED_NOTE.sub("", source[0])


_release_setup = globals().get("setup")


def setup(app):
if _release_setup is not None:
_release_setup(app)
app.connect("html-page-context", _add_generate_nav_html)
app.connect("source-read", _remove_unreleased_note)