Skip to content

Commit

Permalink
Attempt to update RTD for new build process.
Browse files Browse the repository at this point in the history
  • Loading branch information
wcawijngaards committed Jul 17, 2024
1 parent c23dc02 commit 1d3f716
Show file tree
Hide file tree
Showing 2 changed files with 46 additions and 0 deletions.
1 change: 1 addition & 0 deletions requirements.txt
Original file line number Diff line number Diff line change
Expand Up @@ -5,3 +5,4 @@ sphinx-tabs==3.4.4
sphinx-copybutton==0.5.2
sphinx-notfound-page
sphinx-rtd-theme
requests
45 changes: 45 additions & 0 deletions source/conf.py
Original file line number Diff line number Diff line change
Expand Up @@ -16,8 +16,10 @@
# import sys
# sys.path.insert(0, os.path.abspath('.'))

import os
import datetime
import sphinx_rtd_theme
import requests

# -- Project information -----------------------------------------------------

Expand All @@ -31,6 +33,18 @@
# The full version, including alpha/beta/rc tags
release = version

try:
response_versions = requests.get(
f"https://readthedocs.org/api/v2/version/?project__slug=unbound&active=true",
timeout=2,
).json()
versions = [
(version["slug"], f"/{version['project']['language']}/{version['slug']}/")
for version in response_versions["results"]
]
except Exception:
versions = []

# -- General configuration ---------------------------------------------------

# If your documentation needs a minimal Sphinx version, state it here.
Expand All @@ -49,6 +63,7 @@
'sphinx.ext.autosectionlabel',
'notfound.extension',
'sphinxcontrib.jquery',
'sphinx_rtd_theme',
]

intersphinx_mapping = {
Expand Down Expand Up @@ -129,6 +144,36 @@
#
# html_sidebars = {}

# Set canonical URL from the Read the Docs Domain
html_baseurl = os.environ.get("READTHEDOCS_CANONICAL_URL", "")
scheme = "https"

html_context = {
'html_theme': html_theme,
'current_version': version,
'version_slug': version,

'PRODUCTION_DOMAIN': "readthedocs.org",
'versions': versions,
# "downloads": downloads,
# "subprojects": subprojects,

'slug': "unbound",
'rtd_language': language,
'canonical_url': html_baseurl,

'conf_py_path': "/source/",

'github_user': "NLnetLabs",
'github_repo': "unbound",
'github_version': os.environ.get("READTHEDOCS_GIT_IDENTIFIER", "main"),
'display_github': True,
'READTHEDOCS': True,
'using_theme': False,
'new_theme': True,
'source_suffix': ".rst",
'docsearch_disabled': False,
}

# -- Options for HTMLHelp output ---------------------------------------------

Expand Down

0 comments on commit 1d3f716

Please sign in to comment.