From e02852a43b82f98274dd21f90e7b388d0c288d371b0e3d5b73bfdae674908e97 Mon Sep 17 00:00:00 2001 From: Matej Cepl Date: Fri, 26 Feb 2021 21:41:48 +0000 Subject: [PATCH] Accepting request 875521 from home:bnavigator:branches:devel:languages:python - Some optional dependencies not available for the python36 flavor: * add skip-optional-dependencies-test.patch * don't install numpy, matplotlib and quantities for python36 (NumPy 1.20 does not provide a Python 3.6 build on TW: NEP 29) OBS-URL: https://build.opensuse.org/request/show/875521 OBS-URL: https://build.opensuse.org/package/show/devel:languages:python/python-PyLaTeX?expand=0&rev=11 --- python-PyLaTeX.changes | 8 ++++ python-PyLaTeX.spec | 10 ++-- skip-optional-dependencies-test.patch | 66 +++++++++++++++++++++++++++ 3 files changed, 80 insertions(+), 4 deletions(-) create mode 100644 skip-optional-dependencies-test.patch diff --git a/python-PyLaTeX.changes b/python-PyLaTeX.changes index 811d45a..9b9715e 100644 --- a/python-PyLaTeX.changes +++ b/python-PyLaTeX.changes @@ -1,3 +1,11 @@ +------------------------------------------------------------------- +Fri Feb 26 20:15:47 UTC 2021 - Ben Greiner + +- Some optional dependencies not available for the python36 flavor: + * add skip-optional-dependencies-test.patch + * don't install numpy, matplotlib and quantities for python36 + (NumPy 1.20 does not provide a Python 3.6 build on TW: NEP 29) + ------------------------------------------------------------------- Sun Jan 10 18:05:44 UTC 2021 - andy great diff --git a/python-PyLaTeX.spec b/python-PyLaTeX.spec index 0a66bab..e8f910a 100644 --- a/python-PyLaTeX.spec +++ b/python-PyLaTeX.spec @@ -25,6 +25,8 @@ Summary: A Python library for creating LaTeX files and snippets License: MIT URL: https://github.com/JelteF/PyLaTeX Source: https://github.com/JelteF/PyLaTeX/archive/v%{version}.tar.gz#/PyLaTeX-%{version}.tar.gz +# PATCH-FEATURE-OPENSUSE skip-optional-dependencies-test.patch -- skip testing optional dependencies if not available +Patch0: skip-optional-dependencies-test.patch BuildRequires: %{python_module devel} BuildRequires: %{python_module setuptools} BuildRequires: fdupes @@ -65,12 +67,12 @@ Recommends: tex(tikz.sty) Recommends: tex(xcolor.sty) BuildArch: noarch # SECTION test requirements -BuildRequires: %{python_module matplotlib} -BuildRequires: %{python_module numpy} BuildRequires: %{python_module ordered-set} BuildRequires: %{python_module pytest} -BuildRequires: %{python_module quantities} BuildRequires: texlive-latex +BuildRequires: %{python_module matplotlib if (%python-base without python36-base)} +BuildRequires: %{python_module numpy if (%python-base without python36-base)} +BuildRequires: %{python_module quantities if (%python-base without python36-base)} BuildRequires: tex(amsmath.sty) BuildRequires: tex(booktabs.sty) BuildRequires: tex(cleveref.sty) @@ -107,7 +109,7 @@ BuildRequires: tex(xcolor.sty) PyLaTeX is a Python library for creating and compiling LaTeX files. %prep -%setup -q -n PyLaTeX-%{version} +%autosetup -p1 -n PyLaTeX-%{version} %build %python_build diff --git a/skip-optional-dependencies-test.patch b/skip-optional-dependencies-test.patch new file mode 100644 index 0000000..bed0a11 --- /dev/null +++ b/skip-optional-dependencies-test.patch @@ -0,0 +1,66 @@ +Index: PyLaTeX-1.4.1/tests/test_args.py +=================================================================== +--- PyLaTeX-1.4.1.orig/tests/test_args.py ++++ PyLaTeX-1.4.1/tests/test_args.py +@@ -8,9 +8,7 @@ still exist. An error from this file mea + changed. + """ + +-import numpy as np +-import quantities as pq +-import matplotlib ++import pytest + + from pylatex import Document, Section, Math, Tabular, Figure, SubFigure, \ + Package, TikZ, Axis, Plot, Itemize, Enumerate, Description, MultiColumn, \ +@@ -25,9 +23,6 @@ from pylatex import Document, Section, M + from pylatex.utils import escape_latex, fix_filename, dumps_list, bold, \ + italic, verbatim, NoEscape + +-matplotlib.use('Agg') # Not to use X server. For TravisCI. +-import matplotlib.pyplot as pyplot # noqa +- + + def test_document(): + geometry_options = { +@@ -76,6 +71,7 @@ def test_hyperref(): + + + def test_math(): ++ np = pytest.importorskip("numpy") + math = Math(data=None, inline=False) + repr(math) + +@@ -148,6 +144,12 @@ def test_command(): + + + def test_graphics(): ++ mpl = pytest.importorskip("matplotlib") ++ ++ mpl.use('Agg') # Not to use X server. For TravisCI. ++ ++ import matplotlib.pyplot as pyplot # noqa ++ + f = Figure(data=None, position=None) + + f.add_image(filename='', width=r'0.8\textwidth', placement=r'\centering') +@@ -183,6 +185,7 @@ def test_graphics(): + + + def test_quantities(): ++ pq = pytest.importorskip("quantities") + # Quantities + Quantity(quantity=1*pq.kg) + q = Quantity(quantity=1*pq.kg, format_cb=lambda x: str(int(x))) +Index: PyLaTeX-1.4.1/tests/test_quantities.py +=================================================================== +--- PyLaTeX-1.4.1.orig/tests/test_quantities.py ++++ PyLaTeX-1.4.1/tests/test_quantities.py +@@ -1,5 +1,6 @@ + # -*- coding: utf-8 -*- +-import quantities as pq ++import pytest ++pq = pytest.importorskip("quantities") + + from pylatex.quantities import _dimensionality_to_siunitx, Quantity +