Accepting request 811473 from devel:languages:python:numeric

- Skip tests that randomly fail
- Run the tests on 64bit arm and intel only as elsewhere there are
  >100 test failures

- Add patch no-builddir-freetype.patch to not require freetype
  in build/ subfolder which we use in python macros
  * This is SUSE specific patch
- Make the package multibuild and execute the testsuite

- Remove the is_opensuse literals as we don't want to have matplotlib
  behave differently between openSUSE and SLE jsc#SLE-11752

- Remove the qt4 code support as we do just Qt5 everywhere

OBS-URL: https://build.opensuse.org/request/show/811473
OBS-URL: https://build.opensuse.org/package/show/openSUSE:Factory/python-matplotlib?expand=0&rev=77
This commit is contained in:
Dominique Leuenberger 2020-06-05 18:01:25 +00:00 committed by Git OBS Bridge
commit 037c6e7809
5 changed files with 116 additions and 110 deletions

3
_multibuild Normal file
View File

@ -0,0 +1,3 @@
<multibuild>
<package>test</package>
</multibuild>

BIN
freetype-2.6.1.tar.gz (Stored with Git LFS) Normal file

Binary file not shown.

View File

@ -0,0 +1,30 @@
Index: matplotlib-3.2.1/setupext.py
===================================================================
--- matplotlib-3.2.1.orig/setupext.py
+++ matplotlib-3.2.1/setupext.py
@@ -514,7 +514,7 @@ class FreeType(SetupPackage):
ext.sources.insert(0, 'src/checkdep_freetype2.c')
if options.get('local_freetype'):
src_path = pathlib.Path(
- 'build', f'freetype-{LOCAL_FREETYPE_VERSION}')
+ f'freetype-{LOCAL_FREETYPE_VERSION}')
# Statically link to the locally-built freetype.
# This is certainly broken on Windows.
ext.include_dirs.insert(0, str(src_path / 'include'))
@@ -541,7 +541,7 @@ class FreeType(SetupPackage):
if not options.get('local_freetype'):
return
- src_path = pathlib.Path('build', f'freetype-{LOCAL_FREETYPE_VERSION}')
+ src_path = pathlib.Path(f'freetype-{LOCAL_FREETYPE_VERSION}')
# We've already built freetype
if sys.platform == 'win32':
@@ -555,7 +555,6 @@ class FreeType(SetupPackage):
# do we need to download / load the source from cache?
if not src_path.exists():
- os.makedirs('build', exist_ok=True)
url_fmts = [
('https://downloads.sourceforge.net/project/freetype'

View File

@ -1,3 +1,29 @@
-------------------------------------------------------------------
Thu Jun 4 12:59:00 UTC 2020 - Tomáš Chvátal <tchvatal@suse.com>
- Skip tests that randomly fail
- Run the tests on 64bit arm and intel only as elsewhere there are
>100 test failures
-------------------------------------------------------------------
Mon May 18 08:45:00 UTC 2020 - Tomáš Chvátal <tchvatal@suse.com>
- Add patch no-builddir-freetype.patch to not require freetype
in build/ subfolder which we use in python macros
* This is SUSE specific patch
- Make the package multibuild and execute the testsuite
-------------------------------------------------------------------
Mon May 18 06:56:24 UTC 2020 - Tomáš Chvátal <tchvatal@suse.com>
- Remove the is_opensuse literals as we don't want to have matplotlib
behave differently between openSUSE and SLE jsc#SLE-11752
-------------------------------------------------------------------
Fri May 15 09:03:43 UTC 2020 - Tomáš Chvátal <tchvatal@suse.com>
- Remove the qt4 code support as we do just Qt5 everywhere
-------------------------------------------------------------------
Sat Mar 28 16:40:20 UTC 2020 - Arun Persaud <arun@gmx.de>

View File

@ -17,26 +17,28 @@
%{?!python_module:%define python_module() python-%{**} python3-%{**}}
%define oldpython python
%define skip_python2 1
# No Qt4 plugin on > Leap 15.1
%if 0%{?suse_version} > 1500 || 0%{?sle_version} > 150100
%bcond_with qt4
%else
%bcond_without qt4
%endif
# Not doing tests because they take too long
# The tests also pull in dependencies of all backends done in pure python
%bcond_with tests
Name: python-matplotlib
%global flavor @BUILD_FLAVOR@%{nil}
%if "%{flavor}" == "test"
%define psuffix -test
%bcond_without test
%else
%define psuffix %{nil}
%bcond_with test
%endif
Name: python-matplotlib%{psuffix}
Version: 3.2.1
Release: 0
Summary: Plotting Library for Python
License: SUSE-Matplotlib
Group: Development/Libraries/Python
URL: https://matplotlib.org
Source: https://files.pythonhosted.org/packages/source/m/matplotlib/matplotlib-%{version}.tar.gz
Source1: matplotlib-setup.cfg
# Bundled version of freetype for testing purposes only
Source99: https://downloads.sourceforge.net/project/freetype/freetype2/2.6.1/freetype-2.6.1.tar.gz
Patch0: no-builddir-freetype.patch
BuildRequires: %{python_module Cycler >= 0.10}
BuildRequires: %{python_module devel}
BuildRequires: %{python_module kiwisolver}
@ -50,6 +52,7 @@ BuildRequires: c++_compiler
BuildRequires: fdupes
BuildRequires: pkgconfig
BuildRequires: python-rpm-macros
BuildRequires: qhull-devel >= 2003.1
Requires: python-Cycler >= 0.10
Requires: python-kiwisolver >= 1.0.1
Requires: python-numpy >= 1.7.1
@ -63,9 +66,6 @@ Recommends: poppler-tools
Recommends: python-Pillow
Provides: python-matplotlib-gtk = %{version}
Obsoletes: python-matplotlib-gtk < %{version}
%if 0%{?is_opensuse}
BuildRequires: qhull-devel >= 2003.1
%endif
# SECTION WebAgg dependencies
BuildRequires: %{python_module tornado}
# /SECTION
@ -75,12 +75,11 @@ BuildRequires: pkgconfig(freetype2) >= 2.3
BuildRequires: pkgconfig(libpng) >= 1.2
BuildRequires: pkgconfig(tcl)
# /SECTION
%if %{with tests}
# SECTION testing dependencies
%if %{with test}
BuildRequires: %{python_module mock}
BuildRequires: %{python_module nose}
BuildRequires: %{python_module pytest-xdist}
BuildRequires: %{python_module pytest}
BuildRequires: %{python_module python-dateutil >= 2.1}
# /SECTION
# SECTION cairo dependencies
BuildRequires: %{python_module cairo}
# SECTION GTK3 dependencies
@ -88,7 +87,7 @@ BuildRequires: %{python_module gobject}
# /SECTION
# SECTION Qt5 dependencies
BuildRequires: %{python_module qt5}
BuildRequires: xorg-x11-Xvfb
BuildRequires: xvfb-run
BuildRequires: pkgconfig(gtk+-3.0)
# /SECTION
# SECTION tk dependencies
@ -103,9 +102,8 @@ BuildRequires: inkscape
BuildRequires: poppler-tools
BuildRequires: texlive-dvipng
BuildRequires: texlive-latex
BuildRequires: texlive-tex
%if 0%{?is_opensuse}
BuildRequires: texlive-sfmath
BuildRequires: texlive-tex
BuildRequires: tex(8a.enc)
BuildRequires: tex(helvet.sty)
BuildRequires: tex(phvr7t.tfm)
@ -113,19 +111,9 @@ BuildRequires: tex(pncr7t.tfm)
BuildRequires: tex(psfrag.sty)
BuildRequires: tex(type1cm.sty)
BuildRequires: tex(ucs.sty)
%endif
# /SECTION
# SECTION Qt4 dependencies
%if %{with qt4}
BuildRequires: %{python_module qt4}
%endif
# /SECTION
%endif
%if 0%{?suse_version} >= 1500
Recommends: (python-matplotlib-tk if tk)
%else
Recommends: python-matplotlib-tk
%endif
%python_subpackages
%description
@ -138,7 +126,6 @@ application servers, and six graphical user interface toolkits.
%package cairo
Summary: Cairo backend for %{name}
License: SUSE-Matplotlib
Group: Development/Libraries/Python
Requires: %{name} = %{version}
Requires: python-cairo
@ -149,7 +136,6 @@ for the %{name} plotting package
%package gtk3
Summary: GTK3 backends for %{name}
License: BSD-2-Clause
Group: Development/Libraries/Python
Requires: %{name} = %{version}
Requires: %{name}-cairo = %{version}
Requires: python-gobject
@ -161,49 +147,23 @@ gtk3cairo backends for the %{name} plotting package
%package latex
Summary: Allow rendering latex in %{name}
License: BSD-2-Clause
Group: Development/Libraries/Python
Requires: %{name} = %{version}
Requires: texlive-dvipng
Requires: texlive-latex
Requires: texlive-tex
%if 0%{?is_opensuse}
Requires: texlive-sfmath
%endif
Requires: texlive-tex
%description latex
This package allows %{name} to display latex in plots
and figures.
%package qt-shared
Summary: Shared files for the Qt backends for %{name}
License: BSD-2-Clause
Group: Development/Libraries/Python
Requires: %{name} = %{version}
%description qt-shared
This package includes files needed by both the Qt4-based pyqt4 and
pyside backends and the Qt5-based pyqt5 backend for the %{name}
plotting package
%package qt4
Summary: Qt4 backends for %{name}
License: BSD-2-Clause
Group: Development/Libraries/Python
Requires: %{name} = %{version}
Requires: %{name}-qt-shared = %{version}
Requires: python-qt4 >= 4.0
%description qt4
This package includes the Qt4-based pyqt4 and pyside backends
for the %{name} plotting package
%package qt5
Summary: Qt5 backend for %{name}
License: BSD-2-Clause
Group: Development/Libraries/Python
Requires: %{name} = %{version}
Requires: %{name}-qt-shared = %{version}
Requires: python-qt5
Provides: %{name}-qt-shared = %{version}
Obsoletes: %{name}-qt-shared
%description qt5
This package includes the Qt5-based pyqt5 backend
@ -212,7 +172,6 @@ for the %{name} plotting package
%package tk
Summary: Tk backend for %{name}
License: BSD-2-Clause
Group: Development/Libraries/Python
Requires: %{name} = %{version}
Requires: python-tk
Requires: tcl >= 8.3
@ -224,7 +183,6 @@ for the %{name} plotting package
%package web
Summary: Web backend for %{name}
License: BSD-2-Clause
Group: Development/Libraries/Python
Requires: %{name} = %{version}
Requires: python-tornado
@ -235,7 +193,6 @@ for the %{name} plotting package
%package wx
Summary: WxWidgets backend for %{name}
License: BSD-2-Clause
Group: Development/Libraries/Python
Requires: %{name} = %{version}
Requires: python-wxPython >= 4
@ -244,28 +201,29 @@ This package includes the wxWidgets-based wxagg backend
for %{name} plotting package
%prep
%setup -q -n matplotlib-%{version}
%setup -q -n matplotlib-%{version} -a99
chmod -x lib/matplotlib/mpl-data/images/*.svg
find examples lib/matplotlib lib/mpl_toolkits/mplot3d -type f -name "*.py" -exec sed -i "s|#!\/usr\/bin\/env python||" {} \;
find examples lib/matplotlib lib/mpl_toolkits/mplot3d -type f -name "*.py" -exec sed -i "s|#!\/usr\/bin\/python||" {} \;
cp %{SOURCE1} ./setup.cfg
cp %{SOURCE1} setup.cfg
%if %{without tests}
sed -i -e 's/tests = .*/tests = False/' ./setup.cfg
%patch0 -p1
%if !%{with test}
sed -i -e 's/tests = .*/tests = False/' setup.cfg
%else
# raise tolerance for changes due to freetype 2.6/2.7 rendering differences
sed -i -e 's/\(image_comparison.*\)tol=0/\1tol=0.310/' lib/matplotlib/testing/decorators.py # default
sed -i -e 's/tol=0.002/tol=0.009/' lib/matplotlib/tests/test_streamplot.py
sed -i -e 's/tol=0.*)/tol=0.012)/' lib/matplotlib/tests/test_png.py
# image rotation is broken, investigate
sed -i -e 's/\(image_comparison.*rotate_image.*\)/\1 tol=150,/' lib/matplotlib/tests/test_image.py
# As freetype changes the behaviour slightly for tests always use the bundled freetype
sed -i -e 's:#local_freetype = False:local_freetype = True:' setup.cfg
%endif
%build
%if !%{with test}
export XDG_RUNTIME_DIR=/tmp
%python_build
%endif
%install
%if !%{with test}
export XDG_RUNTIME_DIR=/tmp
%python_install
%{python_expand %fdupes %{buildroot}%{$python_sitearch}
@ -273,15 +231,29 @@ $python -m compileall -d %{$python_sitearch} %{buildroot}%{$python_sitearch}/mat
$python -O -m compileall -d %{$python_sitelib} %{buildroot}%{$python_sitearch}/matplotlib/backends/qt_editor/
%fdupes %{buildroot}%{$python_sitearch}/matplotlib/backends/qt_editor/
}
%if %{with tests}
%check
export DISPLAY=:42
%{_bindir}/Xvfb :42 -screen 0 1024x768x24 >& /tmp/Xvfb.log &
trap "kill $! || true" EXIT
%python_expand PYTHONPATH=%{buildroot}%{$python_sitearch} $python ./tests.py --no-network --recursionlimit=5000
%endif
%if %{with test}
%check
# test_savefig_to_stringio - generated ps is differing a bit
# test_interactive_backend - needs full X session
# test_bbox_inches_tight_raster - resulting PNGs look differently
# test_backend_fallback_headful - fails to detect X session with xvfb
# test_usetex - png differs
# test_pdflatex - output slightly differs
# test_labels test_collection - fails on aarch64
# test_fig_signals - races and fails randomly
# test_otf - fails with tex 2020
# Run on 64bit intel and arm only, on others there are >100 test failures
%ifarch x86_64 aarch64
export XDG_RUNTIME_DIR=/tmp
export PYTHONDONTWRITEBYTECODE=1
%python_exec setup.py build_ext --inplace
%python_expand PYTHONPATH=./lib xvfb-run $python -m pytest -v -n auto -k 'not (test_savefig_to_stringio or test_interactive_backend or test_bbox_inches_tight_raster or test_backend_fallback_headful or test_usetex or test_pdflatex or test_labels or test_collection or test_otf or test_fig_signals)'
%endif
%endif
%if !%{with test}
%files %{python_files}
%doc README.rst
%doc examples/
@ -293,7 +265,6 @@ trap "kill $! || true" EXIT
%{python_sitearch}/mpl_toolkits
%{python_sitearch}/pylab.py*
%pycache_only %{python_sitearch}/__pycache__/pylab.*
%if 0%{?is_opensuse}
%exclude %{python_sitearch}/matplotlib/backends/backend_cairo.*
%exclude %{python_sitearch}/matplotlib/backends/backend_gtk3.*
%exclude %{python_sitearch}/matplotlib/backends/backend_gtk3agg.*
@ -312,9 +283,6 @@ trap "kill $! || true" EXIT
%exclude %{python_sitearch}/matplotlib/backends/tkagg.*
%exclude %{python_sitearch}/matplotlib/backends/web_backend/
%exclude %{python_sitearch}/matplotlib/backends/wx_compat.*
%endif
%ifpycache
%if 0%{?is_opensuse}
%exclude %{python_sitearch}/matplotlib/backends/__pycache__/backend_cairo.*.py*
%exclude %{python_sitearch}/matplotlib/backends/__pycache__/backend_gtk3.*.py*
%exclude %{python_sitearch}/matplotlib/backends/__pycache__/backend_gtk3agg.*.py*
@ -331,15 +299,12 @@ trap "kill $! || true" EXIT
%exclude %{python_sitearch}/matplotlib/backends/__pycache__/qt_compat.*.py*
%exclude %{python_sitearch}/matplotlib/backends/__pycache__/tkagg.*.py*
%exclude %{python_sitearch}/matplotlib/backends/__pycache__/wx_compat.*.py*
%endif
%endif
# Dummy package to pull in latex dependencies.
%files %{python_files latex}
%license LICENSE/
%license doc/users/license.rst
%if 0%{?is_opensuse}
%files %{python_files cairo}
%license LICENSE/
%license doc/users/license.rst
@ -356,12 +321,7 @@ trap "kill $! || true" EXIT
%pycache_only %{python_sitearch}/matplotlib/backends/__pycache__/backend_gtk3agg.*.py*
%pycache_only %{python_sitearch}/matplotlib/backends/__pycache__/backend_gtk3cairo.*.py*
# IMPORTANT: the qt4 backend makes use of the qt5 backend,
# which is actually a generic qt backend.
# So we need to package all the qt5 stuff in a generic
# package, and provide the -qt5 stub package which pulls in
# the python-qt5 dependency.
%files %{python_files qt-shared}
%files %{python_files qt5}
%license LICENSE/
%license doc/users/license.rst
%{python_sitearch}/matplotlib/backends/backend_qt5.py*
@ -372,21 +332,6 @@ trap "kill $! || true" EXIT
%pycache_only %{python_sitearch}/matplotlib/backends/__pycache__/backend_qt5agg.*.py*
%pycache_only %{python_sitearch}/matplotlib/backends/__pycache__/qt_compat.*.py*
%if %{with qt4}
%files %{python_files qt4}
%license LICENSE/
%license doc/users/license.rst
%{python_sitearch}/matplotlib/backends/backend_qt4.py*
%{python_sitearch}/matplotlib/backends/backend_qt4agg.py*
%pycache_only %{python_sitearch}/matplotlib/backends/__pycache__/backend_qt4.*.py*
%pycache_only %{python_sitearch}/matplotlib/backends/__pycache__/backend_qt4agg.*.py*
%endif
%files %{python_files qt5}
%license LICENSE/
%license doc/users/license.rst
%doc README.rst
%files %{python_files tk}
%license LICENSE/
%license doc/users/license.rst
@ -409,7 +354,6 @@ trap "kill $! || true" EXIT
%{python_sitearch}/matplotlib/backends/backend_wxagg.py*
%pycache_only %{python_sitearch}/matplotlib/backends/__pycache__/backend_wx.*.py*
%pycache_only %{python_sitearch}/matplotlib/backends/__pycache__/backend_wxagg.*.py*
%endif
%changelog