Fix compatibility with Sphinx 5

This commit is contained in:
Karolina Surma 2022-07-07 10:43:45 +02:00
parent 332baf715f
commit 115e072b16
2 changed files with 49 additions and 2 deletions

41
10.patch Normal file
View File

@ -0,0 +1,41 @@
From cae629ac3751e495d8286b15d503ef8bad69bd94 Mon Sep 17 00:00:00 2001
From: Karolina Surma <ksurma@redhat.com>
Date: Thu, 7 Jul 2022 10:37:21 +0200
Subject: [PATCH] Fix compatibility with Sphinx 5
---
tests/test_jsmath.py | 6 +++---
1 file changed, 3 insertions(+), 3 deletions(-)
diff --git a/tests/test_jsmath.py b/tests/test_jsmath.py
index 573d262..eea8a95 100644
--- a/tests/test_jsmath.py
+++ b/tests/test_jsmath.py
@@ -14,7 +14,7 @@ import pytest
@pytest.mark.sphinx('html', testroot='basic')
def test_basic(app, status, warning):
app.builder.build_all()
- content = (app.outdir / 'math.html').text()
+ content = (app.outdir / 'math.html').read_text()
print(content)
assert '<div class="math notranslate nohighlight">\nE = mc^2</div>' in content
assert ('<span class="eqno">(1)<a class="headerlink" href="#equation-pythagorean" '
@@ -34,7 +34,7 @@ def test_basic(app, status, warning):
def test_numfig_enabled(app, status, warning):
app.builder.build_all()
- content = (app.outdir / 'math.html').text()
+ content = (app.outdir / 'math.html').read_text()
assert '<div class="math notranslate nohighlight">\nE = mc^2</div>' in content
assert ('<span class="eqno">(1.1)<a class="headerlink" href="#equation-pythagorean" '
'title="Permalink to this equation">¶</a></span>'
@@ -52,5 +52,5 @@ def test_numfig_enabled(app, status, warning):
def test_disabled_when_equations_not_found(app, status, warning):
app.builder.build_all()
- content = (app.outdir / 'index.html').text()
+ content = (app.outdir / 'index.html').read_text()
assert 'jsmath.js' not in content
--
2.35.3

View File

@ -5,13 +5,16 @@
Name: python-%{pypi_name}
Version: 1.0.1
Release: 16%{?dist}
Release: 17%{?dist}
Summary: Sphinx extension for math in HTML via JavaScript
License: BSD
URL: http://sphinx-doc.org/
Source0: %{pypi_source}
BuildArch: noarch
# In Sphinx 5 path.read_text() replaces path.text() - compatibility fix
Patch: https://github.com/sphinx-doc/sphinxcontrib-jsmath/pull/10.patch
BuildRequires: python%{python3_pkgversion}-devel
BuildRequires: python%{python3_pkgversion}-setuptools
@ -35,7 +38,7 @@ via JavaScript.
%prep
%autosetup -n %{pypi_name}-%{version}
%autosetup -p1 -n %{pypi_name}-%{version}
%build
@ -61,6 +64,9 @@ via JavaScript.
%changelog
* Thu Jul 07 2022 Karolina Surma <ksurma@redhat.com> - 1.0.1-17
- Fix compatibility with Sphinx 5
* Mon Jun 13 2022 Python Maint <python-maint@redhat.com> - 1.0.1-16
- Rebuilt for Python 3.11