15
0

Accepting request 1238662 from devel:languages:python

- Add support-sphinx-7.4.patch (gh#breathe-doc/breathe!1007)
  fixing tests with Sphinx 7.4.

OBS-URL: https://build.opensuse.org/request/show/1238662
OBS-URL: https://build.opensuse.org/package/show/openSUSE:Factory/python-breathe?expand=0&rev=25
This commit is contained in:
2025-01-20 16:14:08 +00:00
committed by Git OBS Bridge
3 changed files with 85 additions and 6 deletions

View File

@@ -1,3 +1,9 @@
-------------------------------------------------------------------
Sat Jan 18 10:37:41 UTC 2025 - Matej Cepl <mcepl@cepl.eu>
- Add support-sphinx-7.4.patch (gh#breathe-doc/breathe!1007)
fixing tests with Sphinx 7.4.
-------------------------------------------------------------------
Sat Jul 20 01:45:43 UTC 2024 - Matej Cepl <mcepl@cepl.eu>

View File

@@ -1,7 +1,7 @@
#
# spec file for package python-breathe
#
# Copyright (c) 2024 SUSE LLC
# Copyright (c) 2025 SUSE LLC
#
# All modifications and additions to the file contributed by third parties
# remain the property of their copyright owners, unless otherwise agreed
@@ -16,7 +16,6 @@
#
%define modname breathe
%{?sle15_python_module_pythons}
Name: python-breathe
Version: 4.35.0
@@ -24,8 +23,11 @@ Release: 0
Summary: Sphinx Doxygen renderer
License: BSD-3-Clause
URL: https://github.com/michaeljones/breathe
Source: https://github.com/michaeljones/%{modname}/archive/v%{version}.tar.gz#/%{modname}-%{version}.tar.gz
Source: https://github.com/michaeljones/breathe/archive/v%{version}.tar.gz#/breathe-%{version}.tar.gz
Patch0: support-sphinx-7.2.patch
# PATCH-FIX-UPSTREAM support-sphinx-7.4.patch gh#breathe-doc/breathe!1007 mcepl@suse.com
# fix the test suite
Patch1: support-sphinx-7.4.patch
BuildRequires: %{python_module Sphinx >= 4.0}
BuildRequires: %{python_module docutils >= 0.12}
BuildRequires: %{python_module pip}
@@ -54,8 +56,7 @@ able to read and render Doxygen xml output.
%pyproject_wheel
%check
# Tests fail because of gh#breathe-doc/breathe#987
# %%pytest
%pytest
%install
%pyproject_install
@@ -73,6 +74,6 @@ able to read and render Doxygen xml output.
%license LICENSE
%python_alternative %{_bindir}/breathe-apidoc
%{python_sitelib}/breathe
%{python_sitelib}/breathe-%{version}.dist-info
%{python_sitelib}/breathe-%{version}*-info
%changelog

72
support-sphinx-7.4.patch Normal file
View File

@@ -0,0 +1,72 @@
From 44c113677bbb5c5292f6e69fb9f614334eedcb3e Mon Sep 17 00:00:00 2001
From: "Eric T. Johnson" <yut23@users.noreply.github.com>
Date: Thu, 16 Jan 2025 11:49:54 -0500
Subject: [PATCH] Fix tests for Sphinx 7.4 (#1007)
---
breathe/file_state_cache.py | 2 ++
breathe/process.py | 2 ++
tests/test_renderer.py | 9 +++++----
3 files changed, 9 insertions(+), 4 deletions(-)
--- a/breathe/file_state_cache.py
+++ b/breathe/file_state_cache.py
@@ -1,3 +1,5 @@
+from __future__ import annotations
+
from sphinx.application import Sphinx
from sphinx.environment import BuildEnvironment
--- a/breathe/process.py
+++ b/breathe/process.py
@@ -1,3 +1,5 @@
+from __future__ import annotations
+
from breathe.project import AutoProjectInfo, ProjectInfoFactory
import os
--- a/tests/test_renderer.py
+++ b/tests/test_renderer.py
@@ -40,7 +40,7 @@ def app(test_params, app_params, make_ap
except AttributeError:
# old version of Sphinx
kwargs["srcdir"].makedirs(exist_ok=True)
- (kwargs["srcdir"] / "conf.py").write_text("")
+ (kwargs["srcdir"] / "conf.py").write_text("", encoding="ascii")
app_ = make_app(*args, **kwargs)
yield app_
@@ -129,7 +129,7 @@ class MockState:
env.temp_data["docname"] = "mock-doc"
env.temp_data["breathe_project_info_factory"] = ProjectInfoFactory(app)
env.temp_data["breathe_parser_factory"] = DoxygenParserFactory(app)
- settings = frontend.OptionParser(components=(parsers.rst.Parser,)).get_default_values()
+ settings = frontend.get_default_settings(parsers.rst.Parser)
settings.env = env
self.document = utils.new_document("", settings)
@@ -172,13 +172,14 @@ class MockMaskFactory:
class MockContext:
def __init__(self, app, node_stack, domain=None, options=[]):
+ from docutils.statemachine import StringList
self.domain = domain
self.node_stack = node_stack
self.directive_args = [
None, # name
None, # arguments
options, # options
- None, # content
+ StringList([], items=[]), # content
None, # lineno
None, # content_offset
None, # block_text
@@ -564,7 +565,7 @@ def get_matches(datafile):
from xml.dom import minidom
argsstrings = []
- with open(os.path.join(os.path.dirname(__file__), "data", datafile)) as fid:
+ with open(os.path.join(os.path.dirname(__file__), "data", datafile), encoding="utf-8") as fid:
xml = fid.read()
doc = minidom.parseString(xml)