Skip to content

Commit d281701

Browse files
authored
Build: do not use custom builder when DISABLE_SPHINX_MANIPULATION (#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)
1 parent cf582bc commit d281701

File tree

1 file changed

+9
-0
lines changed

1 file changed

+9
-0
lines changed

readthedocs/doc_builder/backends/sphinx.py

+9
Original file line numberDiff line numberDiff line change
@@ -360,6 +360,15 @@ class LocalMediaBuilder(BaseSphinx):
360360
sphinx_builder = "readthedocssinglehtmllocalmedia"
361361
relative_output_dir = "htmlzip"
362362

363+
def __init__(self, *args, **kwargs):
364+
super().__init__(*args, **kwargs)
365+
366+
# The builder `readthedocssinglehtmllocalmedia` is defined by our
367+
# `readthedocs-sphinx-ext` extension that we are not installing
368+
# anymore; so we want to use the default Sphinx `singlehtml` builder
369+
if self.project.has_feature(Feature.DISABLE_SPHINX_MANIPULATION):
370+
self.sphinx_builder = "singlehtml"
371+
363372
def _post_build(self):
364373
"""Internal post build to create the ZIP file from the HTML output."""
365374
target_file = os.path.join(

0 commit comments

Comments
 (0)