Message ID | 20240717105503.568197-1-i.maximets@ovn.org |
---|---|
State | Accepted |
Commit | ebdc3cf91ed582974d67da529e7e6292d3ee9f58 |
Headers | show |
Series | [ovs-dev] docs: Define Read the Docs configuration for Sphinx HTML parameters. | expand |
Context | Check | Description |
---|---|---|
ovsrobot/apply-robot | success | apply and check: success |
ovsrobot/github-robot-_Build_and_Test | success | github build: passed |
ovsrobot/intel-ovs-compilation | fail | test: fail |
On Wed, Jul 17, 2024 at 12:55:02PM +0200, Ilya Maximets wrote: > Read the Docs was always mangling the conf.py during the build to > inject custom domains configured in the project settings and some > other stuff. But they will stop doing that soon [1]. > > Adding recommended changes to the config to get this info from the > environment. > > [1] https://about.readthedocs.com/blog/2024/07/addons-by-default/ > > Signed-off-by: Ilya Maximets <i.maximets@ovn.org> Acked-by: Simon Horman <horms@ovn.org>
On 7/17/24 13:55, Simon Horman wrote: > On Wed, Jul 17, 2024 at 12:55:02PM +0200, Ilya Maximets wrote: >> Read the Docs was always mangling the conf.py during the build to >> inject custom domains configured in the project settings and some >> other stuff. But they will stop doing that soon [1]. >> >> Adding recommended changes to the config to get this info from the >> environment. >> >> [1] https://about.readthedocs.com/blog/2024/07/addons-by-default/ >> >> Signed-off-by: Ilya Maximets <i.maximets@ovn.org> > > Acked-by: Simon Horman <horms@ovn.org> > Thanks, Simon! Applied and backported down to 3.3, since that's the version we're currently building 'stable' documentation from. Best regards, Ilya Maximets.
diff --git a/Documentation/conf.py b/Documentation/conf.py index 15785605a..2364405ad 100644 --- a/Documentation/conf.py +++ b/Documentation/conf.py @@ -12,6 +12,7 @@ # All configuration values have a default; values that are commented out # serve to show the default. +import os import string import sys @@ -108,6 +109,13 @@ html_logo = '_static/logo.png' # so a file named "default.css" will overwrite the builtin "default.css". html_static_path = ['_static'] +# Define the canonical URL for our domain configured on Read the Docs. +html_baseurl = os.environ.get("READTHEDOCS_CANONICAL_URL", "") + +# Tell Jinja2 templates the build is running on Read the Docs. +html_context = {} +if os.environ.get("READTHEDOCS", "") == "True": + html_context["READTHEDOCS"] = True # -- Options for manual page output ---------------------------------------
Read the Docs was always mangling the conf.py during the build to inject custom domains configured in the project settings and some other stuff. But they will stop doing that soon [1]. Adding recommended changes to the config to get this info from the environment. [1] https://about.readthedocs.com/blog/2024/07/addons-by-default/ Signed-off-by: Ilya Maximets <i.maximets@ovn.org> --- Documentation/conf.py | 8 ++++++++ 1 file changed, 8 insertions(+)