Skip to content

Commit

Permalink
Run python -m sphinx rather than sphinx-build (#180)
Browse files Browse the repository at this point in the history
This avoids requiring that the correct ``sphinx-build`` is in the user's PATH.
  • Loading branch information
delfick authored Sep 18, 2024
1 parent 4dbe80d commit 7b10420
Showing 1 changed file with 6 additions and 2 deletions.
8 changes: 6 additions & 2 deletions sphinx_autobuild/build.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
"""Logic for interacting with sphinx-build."""

import subprocess
import sys

from sphinx_autobuild.utils import show

Expand Down Expand Up @@ -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(
Expand Down

0 comments on commit 7b10420

Please sign in to comment.