From a30d62885a7fae863eda5f7cb991f62db990dcf9 Mon Sep 17 00:00:00 2001 From: Jan Holthuis Date: Wed, 5 Aug 2020 14:09:03 +0200 Subject: [PATCH] Spawn a separate process for sphinx-build This avoids issues with cached modules without messing around with `sys.modules` or requiring further configuration from the user. Resolves #21 and #22. --- sphinx_multiversion/main.py | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/sphinx_multiversion/main.py b/sphinx_multiversion/main.py index fb847142..5e960826 100644 --- a/sphinx_multiversion/main.py +++ b/sphinx_multiversion/main.py @@ -232,8 +232,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