Fix for Sphinx 7.2 compatlble with older Sphinx

This commit is contained in:
Sérgio M. Basto 2024-01-11 23:15:50 +00:00
parent df448efc33
commit cc76bbe20e
5 changed files with 56 additions and 50 deletions

View File

@ -1,38 +0,0 @@
From de3504c81c7cefc87c8229743f93232ca00a685d Mon Sep 17 00:00:00 2001
From: Daniel Garcia Moreno <daniel.garcia@suse.com>
Date: Fri, 28 Oct 2022 08:45:33 +0200
Subject: [PATCH 1/2] Fix tests for Sphinx 5.3.0
Fix https://github.com/breathe-doc/breathe/issues/863
---
tests/test_renderer.py | 12 +++++++++++-
1 file changed, 11 insertions(+), 1 deletion(-)
diff --git a/tests/test_renderer.py b/tests/test_renderer.py
index 16889818..a858c65d 100644
--- a/tests/test_renderer.py
+++ b/tests/test_renderer.py
@@ -109,6 +109,12 @@ def __init__(self, **kwargs):
WrappedDoxygenNode.__init__(self, compounddefTypeSub, **kwargs)
+class MockMemo:
+ def __init__(self):
+ self.title_styles = ""
+ self.section_level = ""
+
+
class MockState:
def __init__(self, app):
from breathe.project import ProjectInfoFactory
@@ -123,7 +129,11 @@ def __init__(self, app):
settings.env = env
self.document = utils.new_document("", settings)
- def nested_parse(self, content, content_offset, contentnode):
+ # In sphinx 5.3.0 the method state.nested_parse is not called directly
+ # so this memo object should exists here
+ self.memo = MockMemo()
+
+ def nested_parse(self, content, content_offset, contentnode, match_titles=1):
pass

27
956.patch Normal file
View File

@ -0,0 +1,27 @@
From 46abd77157a2a57e81586e4f8765ae8f1a09d167 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Mark=C3=A9ta?= <meggy.calabkova@gmail.com>
Date: Wed, 4 Oct 2023 15:53:59 +0200
Subject: [PATCH] support Sphinx 7.2
---
breathe/project.py | 2 +-
tests/test_renderer.py | 6 +++++-
2 files changed, 6 insertions(+), 2 deletions(-)
diff --git a/tests/test_renderer.py b/tests/test_renderer.py
index a858c65d..73a29e4e 100644
--- a/tests/test_renderer.py
+++ b/tests/test_renderer.py
@@ -35,7 +35,11 @@ def app(test_params, app_params, make_app, shared_result):
"""
args, kwargs = app_params
assert "srcdir" in kwargs
- kwargs["srcdir"].makedirs(exist_ok=True)
+ try:
+ kwargs["srcdir"].mkdir(parents=True, exist_ok=True)
+ except AttributeError:
+ # old version of Sphinx
+ kwargs["srcdir"].makedirs(exist_ok=True)
(kwargs["srcdir"] / "conf.py").write_text("")
app_ = make_app(*args, **kwargs)
yield app_

25
964.patch Normal file
View File

@ -0,0 +1,25 @@
From e487d63ca45304fc9e4c0b27de163302aa91ed35 Mon Sep 17 00:00:00 2001
From: Scott Main <scottamain@gmail.com>
Date: Fri, 8 Dec 2023 10:41:12 -0800
Subject: [PATCH] Fix PosixPath issue with Sphinx 7.2
Just need to cast the path to a string.
Fixes https://github.com/breathe-doc/breathe/issues/944
---
breathe/project.py | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/breathe/project.py b/breathe/project.py
index 865236e8..f5b780a4 100644
--- a/breathe/project.py
+++ b/breathe/project.py
@@ -113,7 +113,7 @@ def __init__(self, app: Sphinx):
# Assume general build directory is the doctree directory without the last component.
# We strip off any trailing slashes so that dirname correctly drops the last part.
# This can be overridden with the breathe_build_directory config variable
- self._default_build_dir = os.path.dirname(app.doctreedir.rstrip(os.sep))
+ self._default_build_dir = os.path.dirname(str(app.doctreedir).rstrip(os.sep))
self.project_count = 0
self.project_info_store: Dict[str, ProjectInfo] = {}
self.project_info_for_auto_store: Dict[str, AutoProjectInfo] = {}

View File

@ -1,11 +0,0 @@
--- breathe-4.35.0/tests/test_renderer.py.orig 2024-01-11 18:51:06.375701278 +0000
+++ breathe-4.35.0/tests/test_renderer.py 2024-01-11 18:51:11.394686093 +0000
@@ -35,7 +35,7 @@ def app(test_params, app_params, make_ap
"""
args, kwargs = app_params
assert "srcdir" in kwargs
- kwargs["srcdir"].makedirs(exist_ok=True)
+ kwargs["srcdir"].mkdir(exist_ok=True)
(kwargs["srcdir"] / "conf.py").write_text("")
app_ = make_app(*args, **kwargs)
yield app_

View File

@ -17,7 +17,10 @@ URL: https://github.com/%{owner}/%{srcname}
Source0: %{URL}/archive/v%{version}.tar.gz
Source1: %{URL}/releases/download/v%{version}/%{srcname}-%{version}.tar.gz.sig
Source2: https://keyserver.ubuntu.com/pks/lookup?op=get&search=0x8aed58021feacdd5f27ba0e6a72f627716ea9d96#./vermware.key
Patch1: py_mkdir.patch
# Patch1 first hunk was truncated
Patch1: https://github.com/breathe-doc/breathe/pull/956.patch
# Patch2 is a better fix of first hunk of Path1
Patch2: https://github.com/breathe-doc/breathe/pull/964.patch
BuildArch: noarch