diff --git a/python-Pygments.changes b/python-Pygments.changes index 0ddf66a..c6bda5a 100644 --- a/python-Pygments.changes +++ b/python-Pygments.changes @@ -1,3 +1,9 @@ +------------------------------------------------------------------- +Sun Nov 5 07:15:50 UTC 2023 - Matěj Cepl + +- Add skip-wcag-contrast-ratio.patch to make + python-wcag-contrast-ratio just optional dependency. + ------------------------------------------------------------------- Mon Aug 7 13:10:31 UTC 2023 - Benoît Monin diff --git a/python-Pygments.spec b/python-Pygments.spec index e945a6c..f7bf8d7 100644 --- a/python-Pygments.spec +++ b/python-Pygments.spec @@ -32,18 +32,18 @@ License: BSD-2-Clause Group: Development/Languages/Python URL: https://pygments.org Source: https://files.pythonhosted.org/packages/source/P/Pygments/Pygments-%{version}.tar.gz +# PATCH-FIX-UPSTREAM skip-wcag-contrast-ratio.patch bsc#[0-9]+ mcepl@suse.com +# Don't make wcag-contrast-ratio mandatory for testing +Patch0: skip-wcag-contrast-ratio.patch BuildRequires: %{python_module base >= 3.7} BuildRequires: %{python_module pip} BuildRequires: %{python_module pytest >= 7} BuildRequires: %{python_module setuptools >= 61} -BuildRequires: %{python_module wcag-contrast-ratio} BuildRequires: %{python_module wheel} BuildRequires: fdupes BuildRequires: python-rpm-macros >= 20210929 # Preferred for plugin loading, see https://pygments.org/docs/plugins/ -%if 0%{?python_version_nodots} < 38 -Requires: python-importlib-metadata -%endif +Requires: (python-importlib-metadata if python-base < 3.8) %if %{with libalternatives} Requires: alts BuildRequires: alts @@ -84,7 +84,6 @@ install -Dm0644 doc/pygmentize.1 %{buildroot}%{_mandir}/man1/pygmentize.1 } %check -# skip test that requires wcag-contrast-ratio Python package %pytest %pre diff --git a/skip-wcag-contrast-ratio.patch b/skip-wcag-contrast-ratio.patch new file mode 100644 index 0000000..930b843 --- /dev/null +++ b/skip-wcag-contrast-ratio.patch @@ -0,0 +1,28 @@ +--- + tests/contrast/test_contrasts.py | 8 +++++++- + 1 file changed, 7 insertions(+), 1 deletion(-) + +--- a/tests/contrast/test_contrasts.py ++++ b/tests/contrast/test_contrasts.py +@@ -14,7 +14,11 @@ import os + + import pygments.styles + import pygments.token +-import wcag_contrast_ratio ++try: ++ import wcag_contrast_ratio ++except ImportError: ++ wcag_contrast_ratio = None ++import unittest + + JSON_FILENAME = os.path.join(os.path.dirname(__file__), "min_contrasts.json") + WCAG_AA_CONTRAST = 4.5 +@@ -67,6 +71,8 @@ def update_json(): + ) + + ++@unittest.skipIf(wcag_contrast_ratio is None, ++ "wcag-contrast-ratio has not been installed") + def test_contrasts(fail_if_improved=True): + with open(JSON_FILENAME, encoding="utf-8") as f: + previous_contrasts = json.load(f)