Skip to content

Commit b44dab4

Browse files
authored
Merge pull request #5407 from stsewd/share-doctree-between-builders
Share doctree between builders
2 parents 874c920 + b0f2ccd commit b44dab4

File tree

2 files changed

+25
-13
lines changed

2 files changed

+25
-13
lines changed

readthedocs/doc_builder/backends/sphinx.py

+4-1
Original file line numberDiff line numberDiff line change
@@ -213,11 +213,14 @@ def build(self):
213213
build_command.append('-E')
214214
if self.config.sphinx.fail_on_warning:
215215
build_command.append('-W')
216+
doctree_path = f'_build/doctrees-{self.sphinx_builder}'
217+
if self.project.has_feature(Feature.SHARE_SPHINX_DOCTREE):
218+
doctree_path = '_build/doctrees'
216219
build_command.extend([
217220
'-b',
218221
self.sphinx_builder,
219222
'-d',
220-
'_build/doctrees-{format}'.format(format=self.sphinx_builder),
223+
doctree_path,
221224
'-D',
222225
'language={lang}'.format(lang=project.language),
223226
'.',

readthedocs/projects/models.py

+21-12
Original file line numberDiff line numberDiff line change
@@ -1313,31 +1313,40 @@ def add_features(sender, **kwargs):
13131313
API_LARGE_DATA = 'api_large_data'
13141314
DONT_SHALLOW_CLONE = 'dont_shallow_clone'
13151315
USE_TESTING_BUILD_IMAGE = 'use_testing_build_image'
1316+
SHARE_SPHINX_DOCTREE = 'share_sphinx_doctree'
13161317

13171318
FEATURES = (
13181319
(USE_SPHINX_LATEST, _('Use latest version of Sphinx')),
13191320
(USE_SETUPTOOLS_LATEST, _('Use latest version of setuptools')),
13201321
(ALLOW_DEPRECATED_WEBHOOKS, _('Allow deprecated webhook views')),
13211322
(PIP_ALWAYS_UPGRADE, _('Always run pip install --upgrade')),
1322-
(SKIP_SUBMODULES, _('Skip git submodule checkout')), (
1323+
(SKIP_SUBMODULES, _('Skip git submodule checkout')),
1324+
(
13231325
DONT_OVERWRITE_SPHINX_CONTEXT,
13241326
_(
13251327
'Do not overwrite context vars in conf.py with Read the Docs context',
13261328
),
1327-
), (
1329+
),
1330+
(
13281331
MKDOCS_THEME_RTD,
1329-
_('Use Read the Docs theme for MkDocs as default theme')
1330-
), (
1332+
_('Use Read the Docs theme for MkDocs as default theme'),
1333+
),
1334+
(
13311335
DONT_SHALLOW_CLONE,
1332-
_(
1333-
'Do not shallow clone when cloning git repos',
1334-
),
1335-
), (
1336+
_('Do not shallow clone when cloning git repos'),
1337+
),
1338+
(
13361339
USE_TESTING_BUILD_IMAGE,
1337-
_(
1338-
'Use Docker image labelled as `testing` to build the docs',
1339-
),
1340-
), (API_LARGE_DATA, _('Try alternative method of posting large data'))
1340+
_('Use Docker image labelled as `testing` to build the docs'),
1341+
),
1342+
(
1343+
API_LARGE_DATA,
1344+
_('Try alternative method of posting large data'),
1345+
),
1346+
(
1347+
SHARE_SPHINX_DOCTREE,
1348+
_('Use shared directory for doctrees'),
1349+
),
13411350
)
13421351

13431352
projects = models.ManyToManyField(

0 commit comments

Comments
 (0)