Skip to content

Commit

Permalink
Spawn a separate process for sphinx-build
Browse files Browse the repository at this point in the history
This avoids issues with cached modules without messing around with
`sys.modules` or requiring further configuration from the user.
The performance penalty should be neglible.

Resolves #21 and #22.
  • Loading branch information
Holzhaus committed Aug 5, 2020
1 parent 487611b commit 427ed23
Showing 1 changed file with 2 additions and 4 deletions.
6 changes: 2 additions & 4 deletions sphinx_multiversion/main.py
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,6 @@
import sys
import tempfile

from sphinx.cmd import build as sphinx_build
from sphinx import config as sphinx_config
from sphinx import project as sphinx_project

Expand Down Expand Up @@ -232,8 +231,7 @@ def main(argv=None):
]
)
logger.debug("Running sphinx-build with args: %r", current_argv)
status = sphinx_build.build_main(current_argv)
if status not in (0, None):
return 3
cmd = (sys.executable, "-m", "sphinx", *current_argv)
subprocess.check_call(cmd)

return 0

0 comments on commit 427ed23

Please sign in to comment.