From f3146c1f2d25ba525a47633badf3839a74765449 Mon Sep 17 00:00:00 2001 From: Adam Turner <9087854+aa-turner@users.noreply.github.com> Date: Wed, 2 Oct 2024 17:32:56 +0100 Subject: [PATCH] Use ``-m sphinx build`` if supported --- sphinx_autobuild/build.py | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/sphinx_autobuild/build.py b/sphinx_autobuild/build.py index f4c40b1..678737b 100644 --- a/sphinx_autobuild/build.py +++ b/sphinx_autobuild/build.py @@ -3,6 +3,8 @@ import subprocess import sys +import sphinx + from sphinx_autobuild.utils import show_command, show_message @@ -30,7 +32,10 @@ def __call__(self, *, rebuild: bool = True): ) raise - sphinx_build_args = ["-m", "sphinx"] + self.sphinx_args + if sphinx.version_info[:3] >= (7, 2, 3): + sphinx_build_args = ["-m", "sphinx", "build"] + self.sphinx_args + else: + sphinx_build_args = ["-m", "sphinx"] + self.sphinx_args show_command(["python"] + sphinx_build_args) try: subprocess.run([sys.executable] + sphinx_build_args, check=True)