Script 'mail_helper' called by obssrc Hello community, here is the log from the commit of package python-sphinx-autobuild for openSUSE:Leap:16.0 checked in at 2025-07-24 08:31:20 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ Comparing /work/SRC/openSUSE:Leap:16.0/python-sphinx-autobuild (Old) and /work/SRC/openSUSE:Leap:16.0/.python-sphinx-autobuild.new.8875 (New) ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Package is "python-sphinx-autobuild" Thu Jul 24 08:31:20 2025 rev:2 rq:1293749 version:2024.10.3 Changes: -------- --- /work/SRC/openSUSE:Leap:16.0/python-sphinx-autobuild/python-sphinx-autobuild.changes 2025-05-03 18:45:02.865760089 +0200 +++ /work/SRC/openSUSE:Leap:16.0/.python-sphinx-autobuild.new.8875/python-sphinx-autobuild.changes 2025-07-24 08:31:48.351814305 +0200 @@ -1,0 +2,7 @@ +Wed Nov 20 18:26:43 UTC 2024 - Dirk Müller <dmuel...@suse.com> + +- update to 2024.10.13: + * Improve error handling for failures in pre-build commands. + * Show the changed paths that triggered the rebuild. + +------------------------------------------------------------------- Old: ---- sphinx_autobuild-2024.9.19.tar.gz New: ---- sphinx_autobuild-2024.10.3.tar.gz ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ Other differences: ------------------ ++++++ python-sphinx-autobuild.spec ++++++ --- /var/tmp/diff_new_pack.B3ozjw/_old 2025-07-24 08:31:48.611825115 +0200 +++ /var/tmp/diff_new_pack.B3ozjw/_new 2025-07-24 08:31:48.611825115 +0200 @@ -18,7 +18,7 @@ %{?sle15_python_module_pythons} Name: python-sphinx-autobuild -Version: 2024.9.19 +Version: 2024.10.3 Release: 0 Summary: Rebuild Sphinx documentation on changes, with live-reload in the browser License: MIT ++++++ sphinx_autobuild-2024.9.19.tar.gz -> sphinx_autobuild-2024.10.3.tar.gz ++++++ diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/sphinx_autobuild-2024.9.19/NEWS.rst new/sphinx_autobuild-2024.10.3/NEWS.rst --- old/sphinx_autobuild-2024.9.19/NEWS.rst 2024-09-19 01:10:36.647908000 +0200 +++ new/sphinx_autobuild-2024.10.3/NEWS.rst 2024-10-03 01:15:18.386337800 +0200 @@ -4,6 +4,16 @@ unreleased ---------- +2024.10.03 - 2024-10-03 +----------------------- + +* Improve error handling for failures in pre-build commands. + +2024.10.02 - 2024-10-02 +----------------------- + +* Show the changed paths that triggered the rebuild. + 2024.09.19 - 2024-09-19 ----------------------- diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/sphinx_autobuild-2024.9.19/PKG-INFO new/sphinx_autobuild-2024.10.3/PKG-INFO --- old/sphinx_autobuild-2024.9.19/PKG-INFO 1970-01-01 01:00:00.000000000 +0100 +++ new/sphinx_autobuild-2024.10.3/PKG-INFO 1970-01-01 01:00:00.000000000 +0100 @@ -1,6 +1,6 @@ Metadata-Version: 2.1 Name: sphinx-autobuild -Version: 2024.9.19 +Version: 2024.10.3 Summary: Rebuild Sphinx documentation on changes, with hot reloading in the browser. Author: Adam Turner Author-email: Jonathan Stoppani <jonat...@stoppani.name> diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/sphinx_autobuild-2024.9.19/sphinx_autobuild/__init__.py new/sphinx_autobuild-2024.10.3/sphinx_autobuild/__init__.py --- old/sphinx_autobuild-2024.9.19/sphinx_autobuild/__init__.py 2024-09-19 01:10:36.649908000 +0200 +++ new/sphinx_autobuild-2024.10.3/sphinx_autobuild/__init__.py 2024-10-03 01:15:18.387337700 +0200 @@ -1,3 +1,3 @@ """Rebuild Sphinx documentation on changes, with hot reloading in the browser.""" -__version__ = "2024.09.19" +__version__ = "2024.10.03" diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/sphinx_autobuild-2024.9.19/sphinx_autobuild/__main__.py new/sphinx_autobuild-2024.10.3/sphinx_autobuild/__main__.py --- old/sphinx_autobuild-2024.9.19/sphinx_autobuild/__main__.py 2024-09-19 01:10:36.649908000 +0200 +++ new/sphinx_autobuild-2024.10.3/sphinx_autobuild/__main__.py 2024-10-03 01:15:18.388337600 +0200 @@ -1,5 +1,7 @@ """Entrypoint for ``python -m sphinx_autobuild``.""" +from __future__ import annotations + import argparse import shlex import sys @@ -20,7 +22,7 @@ from sphinx_autobuild.filter import IgnoreFilter from sphinx_autobuild.middleware import JavascriptInjectorMiddleware from sphinx_autobuild.server import RebuildServer -from sphinx_autobuild.utils import find_free_port, open_browser, show +from sphinx_autobuild.utils import find_free_port, open_browser, show_message def main(argv=()): @@ -80,17 +82,17 @@ app = _create_app(watch_dirs, ignore_handler, builder, serve_dir, url_host) if not args.no_initial_build: - show(context="Starting initial build") - builder(rebuild=False) + show_message("Starting initial build") + builder(changed_paths=()) if args.open_browser: open_browser(url_host, args.delay) - show(context="Waiting to detect changes...") + show_message("Waiting to detect changes...") try: uvicorn.run(app, host=host_name, port=port_num, log_level="warning") except KeyboardInterrupt: - show(context="Server ceasing operations. Cheerio!") + show_message("Server ceasing operations. Cheerio!") def _create_app(watch_dirs, ignore_handler, builder, out_dir, url_host): diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/sphinx_autobuild-2024.9.19/sphinx_autobuild/build.py new/sphinx_autobuild-2024.10.3/sphinx_autobuild/build.py --- old/sphinx_autobuild-2024.9.19/sphinx_autobuild/build.py 2024-09-19 01:10:36.649908000 +0200 +++ new/sphinx_autobuild-2024.10.3/sphinx_autobuild/build.py 2024-10-03 01:15:18.388337600 +0200 @@ -1,9 +1,17 @@ """Logic for interacting with sphinx-build.""" +from __future__ import annotations + +import contextlib import subprocess import sys +import traceback +from collections.abc import Sequence +from pathlib import Path + +import sphinx -from sphinx_autobuild.utils import show +from sphinx_autobuild.utils import show_command, show_message class Builder: @@ -12,14 +20,25 @@ self.pre_build_commands = pre_build_commands self.uri = f"http://{url_host}" - def __call__(self, *, rebuild: bool = True): + def __call__(self, *, changed_paths: Sequence[Path]): """Generate the documentation using ``sphinx``.""" - if rebuild: - show(context="Detected change. Rebuilding...") + if changed_paths: + cwd = Path.cwd() + rel_paths = [] + for changed_path in changed_paths[:5]: + if not changed_path.exists(): + continue + with contextlib.suppress(ValueError): + changed_path = changed_path.relative_to(cwd) + rel_paths.append(changed_path.as_posix()) + if rel_paths: + show_message(f"Detected changes ({', '.join(rel_paths)})") + show_message("Rebuilding...") try: for command in self.pre_build_commands: - show(context="pre-build", command=command) + show_message("pre-build") + show_command(command) subprocess.run(command, check=True) except subprocess.CalledProcessError as e: print(f"Pre-build command exited with exit code: {e.returncode}") @@ -27,14 +46,22 @@ "Please fix the cause of the error above or press Ctrl+C to stop the " "server." ) - raise + print( + "The server will continue serving the build folder, but the contents " + "being served are no longer in sync with the documentation sources. " + "Please fix the cause of the error above or press Ctrl+C to stop the " + "server." + ) + traceback.print_exception(e) + return - show(command=["python", "-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, "-m", "sphinx"] + self.sphinx_args, - check=True, - ) + subprocess.run([sys.executable] + sphinx_build_args, check=True) except subprocess.CalledProcessError as e: print(f"Sphinx exited with exit code: {e.returncode}") print( @@ -44,4 +71,4 @@ "server." ) # Remind the user of the server URL for convenience. - show(context=f"Serving on {self.uri}") + show_message(f"Serving on {self.uri}") diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/sphinx_autobuild-2024.9.19/sphinx_autobuild/filter.py new/sphinx_autobuild-2024.10.3/sphinx_autobuild/filter.py --- old/sphinx_autobuild-2024.9.19/sphinx_autobuild/filter.py 2024-09-19 01:10:36.649908000 +0200 +++ new/sphinx_autobuild-2024.10.3/sphinx_autobuild/filter.py 2024-10-03 01:15:18.388337600 +0200 @@ -1,5 +1,7 @@ """Logic for ignoring paths.""" +from __future__ import annotations + import fnmatch import re from pathlib import Path @@ -18,20 +20,20 @@ f"regex_based={self.regex_based_patterns!r})" ) - def __call__(self, path): + def __call__(self, filename: str, /): """Determine if 'path' should be ignored.""" - path = Path(path).resolve().as_posix() + normalised_path = Path(filename).resolve().as_posix() # Any regular pattern matches. for pattern in self.regular_patterns: # separators are normalised before creating the IgnoreFilter - if path.startswith(f"{pattern}/"): + if normalised_path.startswith(f"{pattern}/"): return True - if fnmatch.fnmatch(path, pattern): + if fnmatch.fnmatch(normalised_path, pattern): return True # Any regular expression matches. for regex in self.regex_based_patterns: # NoQA: SIM110 - if regex.search(path): + if regex.search(normalised_path): return True return False diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/sphinx_autobuild-2024.9.19/sphinx_autobuild/server.py new/sphinx_autobuild-2024.10.3/sphinx_autobuild/server.py --- old/sphinx_autobuild-2024.9.19/sphinx_autobuild/server.py 2024-09-19 01:10:36.649908000 +0200 +++ new/sphinx_autobuild-2024.10.3/sphinx_autobuild/server.py 2024-10-03 01:15:18.388337600 +0200 @@ -11,7 +11,7 @@ if TYPE_CHECKING: import os - from collections.abc import Callable + from collections.abc import Callable, Sequence from starlette.types import Receive, Scope, Send @@ -23,7 +23,7 @@ self, paths: list[os.PathLike[str]], ignore_filter: IgnoreFilter, - change_callback: Callable[[], None], + change_callback: Callable[[Sequence[Path]], None], ) -> None: self.paths = [Path(path).resolve(strict=True) for path in paths] self.ignore = ignore_filter @@ -49,12 +49,13 @@ [task.result() for task in done] async def watch(self) -> None: - async for _changes in watchfiles.awatch( + async for changes in watchfiles.awatch( *self.paths, watch_filter=lambda _, path: not self.ignore(path), ): + changed_paths = [Path(path).resolve() for (_, path) in changes] with ProcessPoolExecutor() as pool: - fut = pool.submit(self.change_callback) + fut = pool.submit(self.change_callback, changed_paths=changed_paths) await asyncio.wrap_future(fut) self.flag.set() diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/sphinx_autobuild-2024.9.19/sphinx_autobuild/utils.py new/sphinx_autobuild-2024.10.3/sphinx_autobuild/utils.py --- old/sphinx_autobuild-2024.9.19/sphinx_autobuild/utils.py 2024-09-19 01:10:36.650908000 +0200 +++ new/sphinx_autobuild-2024.10.3/sphinx_autobuild/utils.py 2024-10-03 01:15:18.388337600 +0200 @@ -1,5 +1,7 @@ """Generic utilities.""" +from __future__ import annotations + import shlex import socket import threading @@ -34,11 +36,13 @@ print(f"{Fore.GREEN}[sphinx-autobuild] {colour}{text}{Style.RESET_ALL}") -def show(*, context=None, command=None): - """Show context and command-to-be-executed, with nice formatting and colours.""" - if context is not None: - _log(context, colour=Fore.CYAN) - if command is not None: - assert isinstance(command, (list, tuple)) - msg = f"> {shlex.join(command)}" - _log(msg, colour=Fore.BLUE) +def show_message(context: str, /) -> None: + """Show context, with nice formatting and colours.""" + _log(context, colour=Fore.CYAN) + + +def show_command(command: list[str] | tuple[str, ...], /) -> None: + """Show command-to-be-executed, with nice formatting and colours.""" + assert isinstance(command, (list, tuple)) + msg = f"> {shlex.join(command)}" + _log(msg, colour=Fore.BLUE) diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/sphinx_autobuild-2024.9.19/tests/test_application.py new/sphinx_autobuild-2024.10.3/tests/test_application.py --- old/sphinx_autobuild-2024.9.19/tests/test_application.py 2024-09-19 01:10:36.650908000 +0200 +++ new/sphinx_autobuild-2024.10.3/tests/test_application.py 2024-10-03 01:15:18.388337600 +0200 @@ -26,7 +26,7 @@ app = _create_app([src_dir], ignore_handler, builder, out_dir, url_host) client = TestClient(app) - builder(rebuild=False) + builder(changed_paths=()) response = client.get("/") assert response.status_code == 200