14
0

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
This commit is contained in:
2021-02-26 21:41:48 +00:00
committed by Git OBS Bridge
parent a372d10700
commit e02852a43b
3 changed files with 80 additions and 4 deletions

View File

@@ -1,3 +1,11 @@
-------------------------------------------------------------------
Fri Feb 26 20:15:47 UTC 2021 - Ben Greiner <code@bnavigator.de>
- 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 <andythe_great@pm.me>

View File

@@ -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

View File

@@ -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