Skip to content

Commit

Permalink
Build: do not use custom builder when DISABLE_SPHINX_MANIPULATION (#…
Browse files Browse the repository at this point in the history
…11499)

We are installing `readthedocssinglehtmllocalmedia` Sphinx builder via our
`readthedocs-sphinx-ext` extension.

I checked that code and this builder doesn't do anything super special. It only
adds a CSS file that it's related with the flyout, which it's not useful
anymore:
https://github.com/readthedocs/readthedocs-sphinx-ext/blob/13edf78bab374f51e314e4994c319fadbab806f2/readthedocs_ext/readthedocs.py#L81-L83

This commit runs `singlehtml` Sphinx builder (the default from Sphinx) when the
`DISABLE_SPHINX_MANIPULATION` feature flag is enabled. I tested this locally
using `all-formats` branch from `test-builds` and I got the same results (except
from the flyout, which is not injected anymore since there is no context
injected in the new behavior)
  • Loading branch information
humitos authored Jul 25, 2024
1 parent cf582bc commit d281701
Showing 1 changed file with 9 additions and 0 deletions.
9 changes: 9 additions & 0 deletions readthedocs/doc_builder/backends/sphinx.py
Original file line number Diff line number Diff line change
Expand Up @@ -360,6 +360,15 @@ class LocalMediaBuilder(BaseSphinx):
sphinx_builder = "readthedocssinglehtmllocalmedia"
relative_output_dir = "htmlzip"

def __init__(self, *args, **kwargs):
super().__init__(*args, **kwargs)

# The builder `readthedocssinglehtmllocalmedia` is defined by our
# `readthedocs-sphinx-ext` extension that we are not installing
# anymore; so we want to use the default Sphinx `singlehtml` builder
if self.project.has_feature(Feature.DISABLE_SPHINX_MANIPULATION):
self.sphinx_builder = "singlehtml"

def _post_build(self):
"""Internal post build to create the ZIP file from the HTML output."""
target_file = os.path.join(
Expand Down

0 comments on commit d281701

Please sign in to comment.