File tree 2 files changed +19
-4
lines changed
2 files changed +19
-4
lines changed Original file line number Diff line number Diff line change @@ -232,8 +232,7 @@ def build(self):
232
232
self .clean ()
233
233
project = self .project
234
234
build_command = [
235
- 'python' ,
236
- self .python_env .venv_bin (filename = 'sphinx-build' ),
235
+ * self .get_sphinx_cmd (),
237
236
'-T' ,
238
237
]
239
238
if self ._force :
@@ -259,6 +258,18 @@ def build(self):
259
258
)
260
259
return cmd_ret .successful
261
260
261
+ def get_sphinx_cmd (self ):
262
+ if self .project .has_feature (Feature .FORCE_SPHINX_FROM_VENV ):
263
+ return (
264
+ self .python_env .venv_bin (filename = 'python' ),
265
+ '-m' ,
266
+ 'sphinx' ,
267
+ )
268
+ return (
269
+ 'python' ,
270
+ self .python_env .venv_bin (filename = 'sphinx-build' ),
271
+ )
272
+
262
273
def venv_sphinx_supports_latexmk (self ):
263
274
"""
264
275
Check if ``sphinx`` from the user's venv supports ``latexmk``.
@@ -434,8 +445,7 @@ def build(self):
434
445
435
446
# Default to this so we can return it always.
436
447
self .run (
437
- 'python' ,
438
- self .python_env .venv_bin (filename = 'sphinx-build' ),
448
+ * self .get_sphinx_cmd (),
439
449
'-b' ,
440
450
'latex' ,
441
451
'-D' ,
Original file line number Diff line number Diff line change @@ -1584,6 +1584,7 @@ def add_features(sender, **kwargs):
1584
1584
CACHED_ENVIRONMENT = 'cached_environment'
1585
1585
CELERY_ROUTER = 'celery_router'
1586
1586
LIMIT_CONCURRENT_BUILDS = 'limit_concurrent_builds'
1587
+ FORCE_SPHINX_FROM_VENV = 'force_sphinx_from_venv'
1587
1588
LIST_PACKAGES_INSTALLED_ENV = 'list_packages_installed_env'
1588
1589
VCS_REMOTE_LISTING = 'vcs_remote_listing'
1589
1590
@@ -1664,6 +1665,10 @@ def add_features(sender, **kwargs):
1664
1665
LIMIT_CONCURRENT_BUILDS ,
1665
1666
_ ('Limit the amount of concurrent builds' ),
1666
1667
),
1668
+ (
1669
+ FORCE_SPHINX_FROM_VENV ,
1670
+ _ ('Force to use Sphinx from the current virtual environment' ),
1671
+ ),
1667
1672
(
1668
1673
LIST_PACKAGES_INSTALLED_ENV ,
1669
1674
_ (
You can’t perform that action at this time.
0 commit comments