Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix #148 and #162 #164

Merged
merged 3 commits into from
Sep 3, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions sphinx_autobuild/__main__.py
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,10 @@ def main(argv=()):
"""Actual application logic."""
colorama.init()

if not argv:
# entry point functions don't receive args
argv = sys.argv[1:]

args, build_args = _parse_args(list(argv))

src_dir = args.sourcedir
Expand Down
13 changes: 4 additions & 9 deletions sphinx_autobuild/build.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,6 @@

import subprocess

# This isn't public API, but we want to avoid a subprocess call
from sphinx.cmd.build import build_main

from sphinx_autobuild.utils import show


Expand Down Expand Up @@ -32,12 +29,10 @@ def __call__(self, *, rebuild: bool = True):
raise

show(command=["sphinx-build"] + self.sphinx_args)

# NOTE:
# sphinx.cmd.build.build_main is not considered to be public API,
# but as this is a first-party project, we can cheat a little bit.
if return_code := build_main(self.sphinx_args):
print(f"Sphinx exited with exit code: {return_code}")
try:
subprocess.run(["sphinx-build"] + self.sphinx_args, check=True)
except subprocess.CalledProcessError as e:
print(f"Sphinx exited with exit code: {e.returncode}")
print(
"The server will continue serving the build folder, but the contents "
"being served are no longer in sync with the documentation sources. "
Expand Down
Loading