diff --git a/fix-tests-with-pygments-210.patch b/fix-tests-with-pygments-210.patch new file mode 100644 index 0000000..8577fc0 --- /dev/null +++ b/fix-tests-with-pygments-210.patch @@ -0,0 +1,62 @@ +From 06ec5b027d01e8f7717e4687f89f335e83545ff9 Mon Sep 17 00:00:00 2001 +From: Takeshi KOMIYA +Date: Wed, 18 Aug 2021 01:50:08 +0900 +Subject: [PATCH] Fix test: Tests has been broken with pygments-2.10+ + +--- + tests/test_intl.py | 21 +++++++++++++++++---- + 1 file changed, 17 insertions(+), 4 deletions(-) + +diff --git a/tests/test_intl.py b/tests/test_intl.py +index 7791b4aeed5..e9e7ee9e24b 100644 +--- a/tests/test_intl.py ++++ b/tests/test_intl.py +@@ -12,6 +12,7 @@ + import os + import re + ++import pygments + import pytest + from babel.messages import mofile, pofile + from babel.messages.catalog import Catalog +@@ -30,6 +31,8 @@ + }, + ) + ++pygments_version = tuple(int(v) for v in pygments.__version__.split('.')) ++ + + def read_po(pathname): + with pathname.open() as f: +@@ -1060,8 +1063,13 @@ def test_additional_targets_should_not_be_translated(app): + assert_count(expected_expr, result, 1) + + # C code block with lang should not be translated but be *C* highlighted +- expected_expr = ("""#include """ +- """<stdio.h>""") ++ if pygments_version < (2, 10, 0): ++ expected_expr = ("""#include """ ++ """<stdio.h>""") ++ else: ++ expected_expr = ("""#include""" ++ """ """ ++ """<stdio.h>""") + assert_count(expected_expr, result, 1) + + # literal block in list item should not be translated +@@ -1138,8 +1146,13 @@ def test_additional_targets_should_be_translated(app): + assert_count(expected_expr, result, 1) + + # C code block with lang should be translated and be *C* highlighted +- expected_expr = ("""#include """ +- """<STDIO.H>""") ++ if pygments_version < (2, 10, 0): ++ expected_expr = ("""#include """ ++ """<STDIO.H>""") ++ else: ++ expected_expr = ("""#include""" ++ """ """ ++ """<STDIO.H>""") + assert_count(expected_expr, result, 1) + + # literal block in list item should be translated diff --git a/python-sphinx.spec b/python-sphinx.spec index 6b4300d..65adf2a 100644 --- a/python-sphinx.spec +++ b/python-sphinx.spec @@ -28,7 +28,7 @@ Name: python-sphinx #global prerel ... %global upstream_version %{general_version}%{?prerel} Version: %{general_version}%{?prerel:~%{prerel}} -Release: 1%{?dist} +Release: 2%{?dist} Epoch: 1 Summary: Python documentation generator @@ -47,6 +47,9 @@ Patch1: sphinx-test_theming.diff # `types.Union` was renamed to `types.UnionType` on the HEAD of Python 3.10 # (refs: python/cpython#27342). Afterwars, sphinx-build crashes because of ImportError Patch2: rename-types-Union-to-types-UnionType.patch +# Fix test failures with python-pygments 2.10+ +# https://github.com/sphinx-doc/sphinx/pull/9557 +Patch3: fix-tests-with-pygments-210.patch BuildArch: noarch @@ -368,6 +371,9 @@ mkdir %{buildroot}%{python3_sitelib}/sphinxcontrib %changelog +* Wed Aug 18 2021 Karolina Surma - 1:4.1.2-2 +- Patch python-sphinx to work with python-pygments >=2.10 + * Mon Aug 02 2021 Karolina Surma - 1:4.1.2-1 - Update to 4.1.2 - Fixes rhbz#1979326