Update to 7.2.6

This commit is contained in:
Karolina Surma 2023-09-01 10:17:06 +02:00
parent 5f7ebc734f
commit 72bb1987ee
6 changed files with 19 additions and 168 deletions

1
.gitignore vendored
View File

@ -45,3 +45,4 @@
/Sphinx-6.2.1.tar.gz
/Sphinx-7.0.1.tar.gz
/sphinx-7.1.2.tar.gz
/sphinx-7.2.6.tar.gz

View File

@ -1,56 +0,0 @@
From 083d573b7cf42d98f6c946715f52becba11d674b Mon Sep 17 00:00:00 2001
From: Adam Turner <9087854+aa-turner@users.noreply.github.com>
Date: Mon, 7 Aug 2023 21:02:25 +0100
Subject: [PATCH] Fix ``test_dark_style`` for Pygments 2.16
---
tests/test_theming.py | 20 +++++++++++++++++---
1 file changed, 17 insertions(+), 3 deletions(-)
diff --git a/tests/test_theming.py b/tests/test_theming.py
index 7473cb371c5..e3bd2a0f016 100644
--- a/tests/test_theming.py
+++ b/tests/test_theming.py
@@ -5,6 +5,7 @@
import alabaster
import pytest
+import sphinx.builders.html
from sphinx.theming import ThemeError
@@ -91,18 +92,31 @@ def test_staticfiles(app, status, warning):
@pytest.mark.sphinx(testroot='theming',
confoverrides={'html_theme': 'test-theme'})
-def test_dark_style(app, status, warning):
+def test_dark_style(app, monkeypatch):
+ monkeypatch.setattr(sphinx.builders.html, '_file_checksum', lambda o, f: '')
+
style = app.builder.dark_highlighter.formatter_args.get('style')
assert style.__name__ == 'MonokaiStyle'
app.build()
assert (app.outdir / '_static' / 'pygments_dark.css').exists()
+ css_file, properties = app.registry.css_files[0]
+ assert css_file == 'pygments_dark.css'
+ assert "media" in properties
+ assert properties["media"] == '(prefers-color-scheme: dark)'
+
+ assert sorted(app.builder.css_files) == [
+ '_static/classic.css',
+ '_static/pygments.css',
+ '_static/pygments_dark.css',
+ ]
+
result = (app.outdir / 'index.html').read_text(encoding='utf8')
- assert '<link rel="stylesheet" type="text/css" href="_static/pygments.css?v=b76e3c8a" />' in result
+ assert '<link rel="stylesheet" type="text/css" href="_static/pygments.css" />' in result
assert ('<link id="pygments_dark_css" media="(prefers-color-scheme: dark)" '
'rel="stylesheet" type="text/css" '
- 'href="_static/pygments_dark.css?v=e15ddae3" />') in result
+ 'href="_static/pygments_dark.css" />') in result
@pytest.mark.sphinx(testroot='theming')

View File

@ -1,100 +0,0 @@
From 85ffb3b0fdcfefd5484e3fa895a46e3d11d7284f Mon Sep 17 00:00:00 2001
From: Adam Turner <9087854+aa-turner@users.noreply.github.com>
Date: Mon, 7 Aug 2023 21:51:05 +0100
Subject: [PATCH] Fix ``test_assets_order`` for Pygments 2.16
---
tests/roots/test-html_file_checksum/conf.py | 1 +
tests/roots/test-html_file_checksum/index.rst | 0
tests/roots/test-html_file_checksum/static/empty.js | 0
.../roots/test-html_file_checksum/static/script.js | 1 +
.../test-html_file_checksum/static/stylesheet-a.css | 1 +
.../test-html_file_checksum/static/stylesheet-b.css | 1 +
tests/test_build_html.py | 13 ++++++++-----
7 files changed, 12 insertions(+), 5 deletions(-)
create mode 100644 tests/roots/test-html_file_checksum/conf.py
create mode 100644 tests/roots/test-html_file_checksum/index.rst
create mode 100644 tests/roots/test-html_file_checksum/static/empty.js
create mode 100644 tests/roots/test-html_file_checksum/static/script.js
create mode 100644 tests/roots/test-html_file_checksum/static/stylesheet-a.css
create mode 100644 tests/roots/test-html_file_checksum/static/stylesheet-b.css
diff --git a/tests/roots/test-html_file_checksum/conf.py b/tests/roots/test-html_file_checksum/conf.py
new file mode 100644
index 00000000000..f9188142153
--- /dev/null
+++ b/tests/roots/test-html_file_checksum/conf.py
@@ -0,0 +1 @@
+html_static_path = ['static']
diff --git a/tests/roots/test-html_file_checksum/index.rst b/tests/roots/test-html_file_checksum/index.rst
new file mode 100644
index 00000000000..e69de29bb2d
diff --git a/tests/roots/test-html_file_checksum/static/empty.js b/tests/roots/test-html_file_checksum/static/empty.js
new file mode 100644
index 00000000000..e69de29bb2d
diff --git a/tests/roots/test-html_file_checksum/static/script.js b/tests/roots/test-html_file_checksum/static/script.js
new file mode 100644
index 00000000000..9a21456003e
--- /dev/null
+++ b/tests/roots/test-html_file_checksum/static/script.js
@@ -0,0 +1 @@
+/* Script */
diff --git a/tests/roots/test-html_file_checksum/static/stylesheet-a.css b/tests/roots/test-html_file_checksum/static/stylesheet-a.css
new file mode 100644
index 00000000000..3a5d802510d
--- /dev/null
+++ b/tests/roots/test-html_file_checksum/static/stylesheet-a.css
@@ -0,0 +1 @@
+/* Stylesheet A */
diff --git a/tests/roots/test-html_file_checksum/static/stylesheet-b.css b/tests/roots/test-html_file_checksum/static/stylesheet-b.css
new file mode 100644
index 00000000000..ad5ff28f692
--- /dev/null
+++ b/tests/roots/test-html_file_checksum/static/stylesheet-b.css
@@ -0,0 +1 @@
+/* Stylesheet B */
diff --git a/tests/test_build_html.py b/tests/test_build_html.py
index 9a6326c69f5..5a10c964ae0 100644
--- a/tests/test_build_html.py
+++ b/tests/test_build_html.py
@@ -10,6 +10,7 @@
import pytest
from html5lib import HTMLParser
+import sphinx.builders.html
from sphinx.builders.html import validate_html_extra_path, validate_html_static_path
from sphinx.errors import ConfigError
from sphinx.testing.util import strip_escseq
@@ -1172,7 +1173,9 @@ def test_html_assets(app):
@pytest.mark.sphinx('html', testroot='html_assets')
-def test_assets_order(app):
+def test_assets_order(app, monkeypatch):
+ monkeypatch.setattr(sphinx.builders.html, '_file_checksum', lambda o, f: '')
+
app.add_css_file('normal.css')
app.add_css_file('early.css', priority=100)
app.add_css_file('late.css', priority=750)
@@ -1188,8 +1191,8 @@ def test_assets_order(app):
# css_files
expected = [
'_static/early.css',
- '_static/pygments.css?v=b3523f8e',
- '_static/alabaster.css?v=039e1c02',
+ '_static/pygments.css',
+ '_static/alabaster.css',
'https://example.com/custom.css',
'_static/normal.css',
'_static/late.css',
@@ -1202,8 +1205,8 @@ def test_assets_order(app):
# js_files
expected = [
'_static/early.js',
- '_static/doctools.js?v=888ff710',
- '_static/sphinx_highlight.js?v=4825356b',
+ '_static/doctools.js',
+ '_static/sphinx_highlight.js',
'https://example.com/script.js',
'_static/normal.js',
'_static/late.js',

View File

@ -21,11 +21,11 @@
%bcond latex_tests 1
Name: python-sphinx
%global general_version 7.1.2
%global general_version 7.2.6
#global prerel ...
%global upstream_version %{general_version}%{?prerel}
Version: %{general_version}%{?prerel:~%{prerel}}
Release: 2%{?dist}
Release: 1%{?dist}
Epoch: 1
Summary: Python documentation generator
@ -40,12 +40,6 @@ Source: %{pypi_source sphinx %{upstream_version}}
# which causes that test to fail.
Patch: sphinx-test_theming.diff
# Fix test_assets_order for Sphinx 7.1.2
Patch: https://github.com/sphinx-doc/sphinx/commit/85ffb3b0.patch
# Fix test_dark_style with Pygments 2.16+
Patch: https://github.com/sphinx-doc/sphinx/commit/083d573b.patch
BuildArch: noarch
BuildRequires: make
@ -250,6 +244,14 @@ rm tests/test_build_linkcheck.py tests/test_ext_intersphinx.py
sed -i '/html5lib/d' pyproject.toml
%endif
# Sphinx' tests import from each other, this feature is not supported by
# the 'importlib' import mode in pytest. Upstream mitigates this by invoking
# `python -m pytest` rather than `pytest` directly, but in the context of the
# RPM build we explicitly want to test the installed library rather than the
# one from PWD.
# https://github.com/sphinx-doc/sphinx/issues/11740
sed -i '/"--import-mode=importlib",/d' pyproject.toml
%generate_buildrequires
%pyproject_buildrequires -r %{?with_tests:-x test}
@ -367,6 +369,10 @@ mkdir %{buildroot}%{python3_sitelib}/sphinxcontrib
%changelog
* Thu Oct 26 2023 Karolina Surma <ksurma@redhat.com> - 1:7.2.6-1
- Update to 7.2.6
- Fixes rhbz#2232469
* Thu Sep 21 2023 Karolina Surma <ksurma@redhat.com> - 1:7.1.2-2
- Fix FTBFS with Pygments 2.16+

View File

@ -1 +1 @@
SHA512 (sphinx-7.1.2.tar.gz) = d6bccdaa476c700bef444736bb439a4097b9cd40d9c2fce1c3bb889f3677b6d17fe2833b0d3cf4cd3e43927f5fe6f59825f290dabeb2736e77f7f1f26c84d2ec
SHA512 (sphinx-7.2.6.tar.gz) = 9a42e38c3c54429cc008b58892297ade4ccdd67561ee671e42a1fae976955895bb5383d58cb66a4f9f7edd1cc50dc2d1f083efeef036eac9fffc205979d3ccbc

View File

@ -7,6 +7,6 @@ diff -ru Sphinx-1.7.6/tests/test_theming.py Sphinx-1.7.6_patched/tests/test_them
# test Theme class API
- assert set(app.registry.html_themes.keys()) == set(themes)
+ assert set(app.registry.html_themes.keys()) >= set(themes)
assert app.registry.html_themes['test-theme'] == app.srcdir / 'test_theme' / 'test-theme'
assert app.registry.html_themes['ziptheme'] == app.srcdir / 'ziptheme.zip'
assert app.registry.html_themes['staticfiles'] == app.srcdir / 'test_theme' / 'staticfiles'
assert app.registry.html_themes['test-theme'] == str(app.srcdir / 'test_theme' / 'test-theme')
assert app.registry.html_themes['ziptheme'] == str(app.srcdir / 'ziptheme.zip')
assert app.registry.html_themes['staticfiles'] == str(app.srcdir / 'test_theme' / 'staticfiles')