瀏覽代碼

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.
The performance penalty should be neglible.

Resolves #21 and #22.
Jan Holthuis 4 年之前
父節點
當前提交
427ed23445
共有 1 個文件被更改,包括 2 次插入4 次删除
  1. 2 4
      sphinx_multiversion/main.py

+ 2 - 4
sphinx_multiversion/main.py

@@ -11,7 +11,6 @@ import subprocess
 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
 
@@ -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