From 7b10420f5301b8719d0df6520031a33674d859f8 Mon Sep 17 00:00:00 2001 From: Stephen Moore Date: Wed, 18 Sep 2024 11:53:20 +1000 Subject: [PATCH] Run ``python -m sphinx`` rather than ``sphinx-build`` (#180) This avoids requiring that the correct ``sphinx-build`` is in the user's PATH. --- sphinx_autobuild/build.py | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/sphinx_autobuild/build.py b/sphinx_autobuild/build.py index 2c0adc4..b54d4d4 100644 --- a/sphinx_autobuild/build.py +++ b/sphinx_autobuild/build.py @@ -1,6 +1,7 @@ """Logic for interacting with sphinx-build.""" import subprocess +import sys from sphinx_autobuild.utils import show @@ -28,9 +29,12 @@ def __call__(self, *, rebuild: bool = True): ) raise - show(command=["sphinx-build"] + self.sphinx_args) + show(command=["python", "-m", "sphinx"] + self.sphinx_args) try: - subprocess.run(["sphinx-build"] + self.sphinx_args, check=True) + subprocess.run( + [sys.executable, "-m", "sphinx"] + self.sphinx_args, + check=True, + ) except subprocess.CalledProcessError as e: print(f"Sphinx exited with exit code: {e.returncode}") print(