Skip to content

Commit 4624b21

Browse files
authored
Merge pull request #7128 from readthedocs/humitos/sphinx-j-auto
2 parents 4eadf26 + 7f4e8a5 commit 4624b21

File tree

2 files changed

+12
-0
lines changed

2 files changed

+12
-0
lines changed

readthedocs/doc_builder/backends/sphinx.py

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -234,6 +234,7 @@ def build(self):
234234
build_command = [
235235
*self.get_sphinx_cmd(),
236236
'-T',
237+
*self.sphinx_parallel_arg(),
237238
]
238239
if self._force:
239240
build_command.append('-E')
@@ -270,6 +271,11 @@ def get_sphinx_cmd(self):
270271
self.python_env.venv_bin(filename='sphinx-build'),
271272
)
272273

274+
def sphinx_parallel_arg(self):
275+
if self.project.has_feature(Feature.SPHINX_PARALLEL):
276+
return ['-j', 'auto']
277+
return []
278+
273279
def venv_sphinx_supports_latexmk(self):
274280
"""
275281
Check if ``sphinx`` from the user's venv supports ``latexmk``.
@@ -448,6 +454,7 @@ def build(self):
448454
*self.get_sphinx_cmd(),
449455
'-b',
450456
'latex',
457+
*self.sphinx_parallel_arg(),
451458
'-D',
452459
'language={lang}'.format(lang=self.project.language),
453460
'-d',

readthedocs/projects/models.py

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1594,6 +1594,7 @@ def add_features(sender, **kwargs):
15941594
LIST_PACKAGES_INSTALLED_ENV = 'list_packages_installed_env'
15951595
VCS_REMOTE_LISTING = 'vcs_remote_listing'
15961596
STORE_PAGEVIEWS = 'store_pageviews'
1597+
SPHINX_PARALLEL = 'sphinx_parallel'
15971598

15981599
FEATURES = (
15991600
(USE_SPHINX_LATEST, _('Use latest version of Sphinx')),
@@ -1687,6 +1688,10 @@ def add_features(sender, **kwargs):
16871688
STORE_PAGEVIEWS,
16881689
_('Store pageviews for this project'),
16891690
),
1691+
(
1692+
SPHINX_PARALLEL,
1693+
_('Use "-j auto" when calling sphinx-build'),
1694+
),
16901695
)
16911696

16921697
projects = models.ManyToManyField(

0 commit comments

Comments
 (0)