diff --git a/pygments.patch b/pygments.patch new file mode 100644 index 0000000..a816396 --- /dev/null +++ b/pygments.patch @@ -0,0 +1,44 @@ +From 08be21dadfd2ce9e96e41e366ab38bd8d7cd0e39 Mon Sep 17 00:00:00 2001 +From: Dan Lazin +Date: Tue, 7 Jan 2025 16:04:56 -0500 +Subject: [PATCH] Fix test that changed with Pygments 2.19. + +--- + tests/test_markdown.py | 2 +- + 1 file changed, 1 insertion(+), 1 deletion(-) + +Index: rich-13.9.4/tests/test_markdown.py +=================================================================== +--- rich-13.9.4.orig/tests/test_markdown.py ++++ rich-13.9.4/tests/test_markdown.py +@@ -110,7 +110,7 @@ def test_inline_code(): + inline_code_theme="emacs", + ) + result = render(markdown) +- expected = "inline \x1b[1;38;2;170;34;255;48;2;248;248;248mimport\x1b[0m\x1b[38;2;0;0;0;48;2;248;248;248m \x1b[0m\x1b[1;38;2;0;0;255;48;2;248;248;248mthis\x1b[0m code \n" ++ expected = "inline \x1b[1;38;2;170;34;255;48;2;248;248;248mimport\x1b[0m\x1b[38;2;187;187;187;48;2;248;248;248m \x1b[0m\x1b[1;38;2;0;0;255;48;2;248;248;248mthis\x1b[0m code \n" + print(result) + print(repr(result)) + assert result == expected +Index: rich-13.9.4/tests/test_syntax.py +=================================================================== +--- rich-13.9.4.orig/tests/test_syntax.py ++++ rich-13.9.4/tests/test_syntax.py +@@ -53,7 +53,7 @@ def test_blank_lines(): + print(repr(result)) + assert ( + result +- == "\x1b[1;38;2;24;24;24;48;2;248;248;248m \x1b[0m\x1b[38;2;173;173;173;48;2;248;248;248m1 \x1b[0m\x1b[48;2;248;248;248m \x1b[0m\n\x1b[1;38;2;24;24;24;48;2;248;248;248m \x1b[0m\x1b[38;2;173;173;173;48;2;248;248;248m2 \x1b[0m\x1b[48;2;248;248;248m \x1b[0m\n\x1b[1;38;2;24;24;24;48;2;248;248;248m \x1b[0m\x1b[38;2;173;173;173;48;2;248;248;248m3 \x1b[0m\x1b[1;38;2;0;128;0;48;2;248;248;248mimport\x1b[0m\x1b[38;2;0;0;0;48;2;248;248;248m \x1b[0m\x1b[1;38;2;0;0;255;48;2;248;248;248mthis\x1b[0m\x1b[48;2;248;248;248m \x1b[0m\n\x1b[1;38;2;24;24;24;48;2;248;248;248m \x1b[0m\x1b[38;2;173;173;173;48;2;248;248;248m4 \x1b[0m\x1b[48;2;248;248;248m \x1b[0m\n\x1b[1;38;2;24;24;24;48;2;248;248;248m \x1b[0m\x1b[38;2;173;173;173;48;2;248;248;248m5 \x1b[0m\x1b[48;2;248;248;248m \x1b[0m\n" ++ == "\x1b[1;38;2;24;24;24;48;2;248;248;248m \x1b[0m\x1b[38;2;173;173;173;48;2;248;248;248m1 \x1b[0m\x1b[48;2;248;248;248m \x1b[0m\n\x1b[1;38;2;24;24;24;48;2;248;248;248m \x1b[0m\x1b[38;2;173;173;173;48;2;248;248;248m2 \x1b[0m\x1b[48;2;248;248;248m \x1b[0m\n\x1b[1;38;2;24;24;24;48;2;248;248;248m \x1b[0m\x1b[38;2;173;173;173;48;2;248;248;248m3 \x1b[0m\x1b[1;38;2;0;128;0;48;2;248;248;248mimport\x1b[0m\x1b[38;2;187;187;187;48;2;248;248;248m \x1b[0m\x1b[1;38;2;0;0;255;48;2;248;248;248mthis\x1b[0m\x1b[48;2;248;248;248m \x1b[0m\n\x1b[1;38;2;24;24;24;48;2;248;248;248m \x1b[0m\x1b[38;2;173;173;173;48;2;248;248;248m4 \x1b[0m\x1b[48;2;248;248;248m \x1b[0m\n\x1b[1;38;2;24;24;24;48;2;248;248;248m \x1b[0m\x1b[38;2;173;173;173;48;2;248;248;248m5 \x1b[0m\x1b[48;2;248;248;248m \x1b[0m\n" + ) + + +@@ -119,7 +119,7 @@ def test_python_render_simple_indent_gui + ) + rendered_syntax = render(syntax) + print(repr(rendered_syntax)) +- expected = '\x1b[34mdef\x1b[0m \x1b[32mloop_first_last\x1b[0m(values: Iterable[T]) -> Iterable[Tuple[\x1b[36mb\x1b[0m\n\x1b[2;37m│ \x1b[0m\x1b[33m"""Iterate and generate a tuple with a flag for first an\x1b[0m\n\x1b[2m│ \x1b[0miter_values = \x1b[36miter\x1b[0m(values)\n\x1b[2m│ \x1b[0m\x1b[34mtry\x1b[0m:\n\x1b[2m│ │ \x1b[0mprevious_value = \x1b[36mnext\x1b[0m(iter_values)\n\x1b[2m│ \x1b[0m\x1b[34mexcept\x1b[0m \x1b[36mStopIteration\x1b[0m:\n\x1b[2m│ │ \x1b[0m\x1b[34mreturn\x1b[0m\n\x1b[2m│ \x1b[0mfirst = \x1b[34mTrue\x1b[0m\n\x1b[2m│ \x1b[0m\x1b[34mfor\x1b[0m value \x1b[35min\x1b[0m iter_values:\n\x1b[2m│ │ \x1b[0m\x1b[34myield\x1b[0m first, \x1b[34mFalse\x1b[0m, previous_value\n\x1b[2m│ │ \x1b[0mfirst = \x1b[34mFalse\x1b[0m\n\x1b[2m│ │ \x1b[0mprevious_value = value\n\x1b[2m│ \x1b[0m\x1b[34myield\x1b[0m first, \x1b[34mTrue\x1b[0m, previous_value\n' ++ expected = '\x1b[34mdef\x1b[0m\x1b[37m \x1b[0m\x1b[32mloop_first_last\x1b[0m(values: Iterable[T]) -> Iterable[Tuple[\x1b[36mb\x1b[0m\n\x1b[2;37m│ \x1b[0m\x1b[33m"""Iterate and generate a tuple with a flag for first an\x1b[0m\n\x1b[2m│ \x1b[0miter_values = \x1b[36miter\x1b[0m(values)\n\x1b[2m│ \x1b[0m\x1b[34mtry\x1b[0m:\n\x1b[2m│ │ \x1b[0mprevious_value = \x1b[36mnext\x1b[0m(iter_values)\n\x1b[2m│ \x1b[0m\x1b[34mexcept\x1b[0m \x1b[36mStopIteration\x1b[0m:\n\x1b[2m│ │ \x1b[0m\x1b[34mreturn\x1b[0m\n\x1b[2m│ \x1b[0mfirst = \x1b[34mTrue\x1b[0m\n\x1b[2m│ \x1b[0m\x1b[34mfor\x1b[0m value \x1b[35min\x1b[0m iter_values:\n\x1b[2m│ │ \x1b[0m\x1b[34myield\x1b[0m first, \x1b[34mFalse\x1b[0m, previous_value\n\x1b[2m│ │ \x1b[0mfirst = \x1b[34mFalse\x1b[0m\n\x1b[2m│ │ \x1b[0mprevious_value = value\n\x1b[2m│ \x1b[0m\x1b[34myield\x1b[0m first, \x1b[34mTrue\x1b[0m, previous_value\n' + assert rendered_syntax == expected + + diff --git a/python-rich.changes b/python-rich.changes index aa74949..44cbe1d 100644 --- a/python-rich.changes +++ b/python-rich.changes @@ -1,3 +1,8 @@ +------------------------------------------------------------------- +Fri Jan 17 14:55:32 UTC 2025 - Markéta Machová + +- Add pygments.patch to fix tests with Pygments 2.19 + ------------------------------------------------------------------- Thu Dec 5 01:45:25 UTC 2024 - Steve Kowalik diff --git a/python-rich.spec b/python-rich.spec index 378429c..670ae5f 100644 --- a/python-rich.spec +++ b/python-rich.spec @@ -1,7 +1,7 @@ # # spec file for package python-rich # -# Copyright (c) 2024 SUSE LLC +# Copyright (c) 2025 SUSE LLC # Copyright (c) 2020-2021, Martin Hauke # # All modifications and additions to the file contributed by third parties @@ -25,12 +25,14 @@ Summary: A Python library for rich text and beautiful formatting in the t License: MIT URL: https://github.com/Textualize/rich Source: https://github.com/Textualize/rich/archive/refs/tags/v%{version}.tar.gz#/rich-%{version}.tar.gz +# PATCH-FIX-UPSTREAM https://github.com/Textualize/rich/pull/3604 Fix test that changed with Pygments 2.19. +# and https://github.com/Textualize/rich/pull/3608 fix remaining tests with Pygments 2.19 #3604 did not fix +Patch: pygments.patch BuildRequires: %{python_module base >= 3.8} BuildRequires: %{python_module markdown-it-py >= 2.2.0} BuildRequires: %{python_module pip} BuildRequires: %{python_module poetry-core} BuildRequires: %{python_module pygments >= 2.13.0} -BuildRequires: %{python_module typing_extensions >= 4.0.0 if %python-base < 3.11} BuildRequires: fdupes BuildRequires: python-rpm-macros Requires: python-markdown-it-py >= 2.2.0 @@ -40,9 +42,6 @@ BuildArch: noarch # SECTION test requirements BuildRequires: %{python_module pytest} # /SECTION -%if 0%{?python_version_nodots} < 311 -Requires: python-typing_extensions >= 4.0.0 -%endif %python_subpackages %description @@ -50,7 +49,7 @@ Render rich text, tables, progress bars, syntax highlighting, markdown and more to the terminal. %prep -%setup -q -n rich-%{version} +%autosetup -p1 -n rich-%{version} %build %pyproject_wheel