From dfe2d65a0e7f2e84dc64311541fa0a2b20df6e011f830b73b669df7e99b1348b Mon Sep 17 00:00:00 2001 From: Dirk Mueller Date: Mon, 28 Sep 2020 13:45:58 +0000 Subject: [PATCH] - add sphinx-pygments-compat.patch (fix tests with newer pygments) OBS-URL: https://build.opensuse.org/package/show/devel:languages:python/python-Sphinx?expand=0&rev=162 --- python-Sphinx.changes | 5 +++++ python-Sphinx.spec | 3 +++ sphinx-pygments-compat.patch | 36 ++++++++++++++++++++++++++++++++++++ 3 files changed, 44 insertions(+) create mode 100644 sphinx-pygments-compat.patch diff --git a/python-Sphinx.changes b/python-Sphinx.changes index d850233..d38b9a2 100644 --- a/python-Sphinx.changes +++ b/python-Sphinx.changes @@ -1,3 +1,8 @@ +------------------------------------------------------------------- +Mon Sep 28 13:45:37 UTC 2020 - Dirk Mueller + +- add sphinx-pygments-compat.patch (fix tests with newer pygments) + ------------------------------------------------------------------- Tue Aug 18 14:44:04 UTC 2020 - Dirk Mueller diff --git a/python-Sphinx.spec b/python-Sphinx.spec index 175ded0..d9bb227 100644 --- a/python-Sphinx.spec +++ b/python-Sphinx.spec @@ -38,6 +38,8 @@ Source: https://files.pythonhosted.org/packages/source/S/Sphinx/Sphinx-% Source1: https://files.pythonhosted.org/packages/source/S/Sphinx/Sphinx-%{version}.tar.gz.asc Source2: python3.inv Source99: python-Sphinx-rpmlintrc +# PATCH-FIX-UPSTREAM: https://patch-diff.githubusercontent.com/raw/sphinx-doc/sphinx/pull/8205.patch +Patch0: sphinx-pygments-compat.patch BuildRequires: %{python_module base} BuildRequires: %{python_module setuptools} BuildRequires: fdupes @@ -217,6 +219,7 @@ This package contains the HTML documentation for Sphinx. %prep %setup -q -n Sphinx-%{version} +%autopatch -p1 sed -i 's/\r$//' sphinx/themes/basic/static/jquery.js # Fix wrong end-of-line encoding diff --git a/sphinx-pygments-compat.patch b/sphinx-pygments-compat.patch new file mode 100644 index 0000000..e8990f4 --- /dev/null +++ b/sphinx-pygments-compat.patch @@ -0,0 +1,36 @@ +From 85b24a2e88ea71edc728aff3b078d34c2f374f06 Mon Sep 17 00:00:00 2001 +From: Takeshi KOMIYA +Date: Sun, 13 Sep 2020 09:16:32 +0900 +Subject: [PATCH] Fix our test failed with pygments-2.7.0 + +Since pygments-2.7.0, it has changed the style of output HTML. +That makes our test broken. This fixes it to pass with new pygments. +--- + tests/test_build_html.py | 8 +++++++- + 1 file changed, 7 insertions(+), 1 deletion(-) + +diff --git a/tests/test_build_html.py b/tests/test_build_html.py +index e949f11572..1efc6c14a6 100644 +--- a/tests/test_build_html.py ++++ b/tests/test_build_html.py +@@ -10,8 +10,10 @@ + + import os + import re ++from distutils.version import LooseVersion + from itertools import cycle, chain + ++import pygments + import pytest + from html5lib import HTMLParser + +@@ -1591,4 +1593,8 @@ def test_html_codeblock_linenos_style_inline(app): + app.build() + content = (app.outdir / 'index.html').read_text() + +- assert '1 ' in content ++ pygments_version = tuple(LooseVersion(pygments.__version__).version) ++ if pygments_version > (2, 7): ++ assert '1' in content ++ else: ++ assert '1 ' in content