dev-python/matplotlib: Bump to 3.3.0

Signed-off-by: Michał Górny <mgorny@gentoo.org>
This commit is contained in:
Michał Górny
2020-07-25 08:02:11 +02:00
parent 07439e9118
commit 00023b8cda
3 changed files with 501 additions and 0 deletions

View File

@@ -4,3 +4,4 @@ DIST matplotlib-2.2.4.tar.gz 36974286 BLAKE2B 9c4c69163a23ff02107ee155f72e142dcf
DIST matplotlib-3.1.2.tar.gz 40909582 BLAKE2B 670907670335ca13ec01f3acf036fd502ce34abd12666b2e0d10867c6115a0fe80039326cee89099471aa6b3bbd25f1ca4aa837072dea624ee41984da9f647be SHA512 2eff3c0525d01824ed758a87f50a3f6094767b580fca1eae4e9dbc2cc972af3d0cc3ac9615e576c5685e8bfc1ec90754bc826635f4f2a919d0b26bbb686cccab
DIST matplotlib-3.2.1.tar.gz 40325615 BLAKE2B 7fd299f7d3948987e341e4313ed82d15de286a05c9819893e099ccd6c1f861ce5548ec85588a382603011e7710d08d6fc9a4f168f0b5705b0873b97e40d2dd39 SHA512 d6497a3c47eaff9c0d981bc03de5894a3f4a5413cbe320924b1df6d68eb421e548cf4247c035fd636a4403cd2d50071633e6906e795b74ec7d9c4816193e42be
DIST matplotlib-3.2.2.tar.gz 40295831 BLAKE2B 32fb34b95d1df928f949fd7b04909da2494b56efbe543f75bffedf1d9d85a0089a50cd27b82a28ac75361b56fe3f2a6c95b7d9e777778ce46f1d2805e5dae9df SHA512 4b8080fddc717f311a87b6ef1a279304da2931ef2d6de85688c153f14da5009351f42d9533c44695ca43ce1496bb642927aca822a7946a2d50d40a7d25224b31
DIST matplotlib-3.3.0.tar.gz 38782487 BLAKE2B 97330d93b8d8a64a1296ccb173e44ebcc54c61e22aacdd73cc38a46fb2d22fbfe7334fb3c6993be001c475724c47f530243affddd71ec647232ac093db6e3135 SHA512 2ffd9e79e300a37092ab4b5a7156c2f57e408975818abd413c74477ad622030c7636695467aab821c9996564cddec57e26ba6a8004f6639070964fcb7a510a75

View File

@@ -0,0 +1,225 @@
From 2fa4f25b9db19a1f59b03d56221c4752c03912fb Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Micha=C5=82=20G=C3=B3rny?= <mgorny@gentoo.org>
Date: Sun, 7 Jun 2020 20:02:48 +0200
Subject: [PATCH] Increase image comparison limits
Most of the tests require exact match which apparently doesn't always
happen in non-pristine environments. Some of them have very big
differences due to texlive font rendering changes.
---
lib/matplotlib/tests/test_arrow_patches.py | 4 ++--
lib/matplotlib/tests/test_axes.py | 2 +-
lib/matplotlib/tests/test_backend_pgf.py | 8 +++++---
lib/matplotlib/tests/test_figure.py | 2 +-
lib/matplotlib/tests/test_legend.py | 6 +++---
lib/matplotlib/tests/test_pickle.py | 2 +-
lib/matplotlib/tests/test_units.py | 4 ++--
lib/matplotlib/tests/test_usetex.py | 3 ++-
lib/mpl_toolkits/tests/test_axes_grid1.py | 2 +-
.../tests/test_axisartist_grid_helper_curvelinear.py | 2 +-
lib/mpl_toolkits/tests/test_mplot3d.py | 2 +-
11 files changed, 20 insertions(+), 17 deletions(-)
diff --git a/lib/matplotlib/tests/test_arrow_patches.py b/lib/matplotlib/tests/test_arrow_patches.py
index cca505ab9..871935c15 100644
--- a/lib/matplotlib/tests/test_arrow_patches.py
+++ b/lib/matplotlib/tests/test_arrow_patches.py
@@ -67,7 +67,7 @@ def __prepare_fancyarrow_dpi_cor_test():
@image_comparison(['fancyarrow_dpi_cor_100dpi.png'], remove_text=True,
- tol=0 if platform.machine() == 'x86_64' else 0.02,
+ tol=0.015 if platform.machine() == 'x86_64' else 0.02,
savefig_kwarg=dict(dpi=100))
def test_fancyarrow_dpi_cor_100dpi():
"""
@@ -82,7 +82,7 @@ def test_fancyarrow_dpi_cor_100dpi():
@image_comparison(['fancyarrow_dpi_cor_200dpi.png'], remove_text=True,
- tol=0 if platform.machine() == 'x86_64' else 0.02,
+ tol=0.018 if platform.machine() == 'x86_64' else 0.02,
savefig_kwarg=dict(dpi=200))
def test_fancyarrow_dpi_cor_200dpi():
"""
diff --git a/lib/matplotlib/tests/test_axes.py b/lib/matplotlib/tests/test_axes.py
index 6eedf20d5..198ed41ec 100644
--- a/lib/matplotlib/tests/test_axes.py
+++ b/lib/matplotlib/tests/test_axes.py
@@ -3718,7 +3718,7 @@ def test_vertex_markers():
@image_comparison(['vline_hline_zorder', 'errorbar_zorder'],
- tol=0 if platform.machine() == 'x86_64' else 0.02)
+ tol=0.015 if platform.machine() == 'x86_64' else 0.02)
def test_eb_line_zorder():
x = list(range(10))
diff --git a/lib/matplotlib/tests/test_backend_pgf.py b/lib/matplotlib/tests/test_backend_pgf.py
index 702cc6c35..71038e702 100644
--- a/lib/matplotlib/tests/test_backend_pgf.py
+++ b/lib/matplotlib/tests/test_backend_pgf.py
@@ -114,7 +114,8 @@ def test_xelatex():
# test compiling a figure to pdf with pdflatex
@needs_pdflatex
@pytest.mark.backend('pgf')
-@image_comparison(['pgf_pdflatex.pdf'], style='default')
+@image_comparison(['pgf_pdflatex.pdf'], style='default',
+ tol=11.669)
def test_pdflatex():
if os.environ.get('APPVEYOR', False):
pytest.xfail("pdflatex test does not work on appveyor due to missing "
@@ -151,7 +152,7 @@ def test_rcupdate():
'pgf.preamble': ('\\usepackage[utf8x]{inputenc}'
'\\usepackage[T1]{fontenc}'
'\\usepackage{sfmath}')}]
- tol = [6, 0]
+ tol = [6, 14]
for i, rc_set in enumerate(rc_sets):
with mpl.rc_context(rc_set):
create_figure()
@@ -178,7 +179,8 @@ def test_pathclip():
# test mixed mode rendering
@needs_xelatex
@pytest.mark.backend('pgf')
-@image_comparison(['pgf_mixedmode.pdf'], style='default')
+@image_comparison(['pgf_mixedmode.pdf'], style='default',
+ tol=1.086)
def test_mixedmode():
rc_xelatex = {'font.family': 'serif',
'pgf.rcfonts': False}
diff --git a/lib/matplotlib/tests/test_figure.py b/lib/matplotlib/tests/test_figure.py
index aab35201c..a657198f7 100644
--- a/lib/matplotlib/tests/test_figure.py
+++ b/lib/matplotlib/tests/test_figure.py
@@ -22,7 +22,7 @@ import pytest
@image_comparison(['figure_align_labels'],
- tol=0 if platform.machine() == 'x86_64' else 0.01)
+ tol=0.02)
def test_align_labels():
fig = plt.figure(tight_layout=True)
gs = gridspec.GridSpec(3, 3)
diff --git a/lib/matplotlib/tests/test_legend.py b/lib/matplotlib/tests/test_legend.py
index 8e9c0771f..d1fb3818a 100644
--- a/lib/matplotlib/tests/test_legend.py
+++ b/lib/matplotlib/tests/test_legend.py
@@ -105,7 +105,7 @@ def test_multiple_keys():
@image_comparison(['rgba_alpha.png'], remove_text=True,
- tol=0 if platform.machine() == 'x86_64' else 0.01)
+ tol=0.02)
def test_alpha_rgba():
fig, ax = plt.subplots(1, 1)
ax.plot(range(10), lw=5)
@@ -114,7 +114,7 @@ def test_alpha_rgba():
@image_comparison(['rcparam_alpha.png'], remove_text=True,
- tol=0 if platform.machine() == 'x86_64' else 0.01)
+ tol=0.02)
def test_alpha_rcparam():
fig, ax = plt.subplots(1, 1)
ax.plot(range(10), lw=5)
@@ -140,7 +140,7 @@ def test_fancy():
@image_comparison(['framealpha'], remove_text=True,
- tol=0 if platform.machine() == 'x86_64' else 0.02)
+ tol=0.02)
def test_framealpha():
x = np.linspace(1, 100, 100)
y = x
diff --git a/lib/matplotlib/tests/test_pickle.py b/lib/matplotlib/tests/test_pickle.py
index 82bf4d8e8..13046357a 100644
--- a/lib/matplotlib/tests/test_pickle.py
+++ b/lib/matplotlib/tests/test_pickle.py
@@ -41,7 +41,7 @@ def test_simple():
@image_comparison(['multi_pickle.png'], remove_text=True, style='mpl20',
- tol=0 if platform.machine() == 'x86_64' else 0.082)
+ tol=0.082)
def test_complete():
fig = plt.figure('Figure with a label?', figsize=(10, 6))
diff --git a/lib/matplotlib/tests/test_units.py b/lib/matplotlib/tests/test_units.py
index 252136b4d..f0e7ced31 100644
--- a/lib/matplotlib/tests/test_units.py
+++ b/lib/matplotlib/tests/test_units.py
@@ -74,7 +74,7 @@ def quantity_converter():
# Tests that the conversion machinery works properly for classes that
# work as a facade over numpy arrays (like pint)
@image_comparison(['plot_pint.png'], remove_text=False, style='mpl20',
- tol=0 if platform.machine() == 'x86_64' else 0.01)
+ tol=0.002 if platform.machine() == 'x86_64' else 0.01)
def test_numpy_facade(quantity_converter):
# use former defaults to match existing baseline image
plt.rcParams['axes.formatter.limits'] = -7, 7
@@ -101,7 +101,7 @@ def test_numpy_facade(quantity_converter):
# Tests gh-8908
@image_comparison(['plot_masked_units.png'], remove_text=True, style='mpl20',
- tol=0 if platform.machine() == 'x86_64' else 0.01)
+ tol=0.02)
def test_plot_masked_units():
data = np.linspace(-5, 5)
data_masked = np.ma.array(data, mask=(data > -2) & (data < 2))
diff --git a/lib/matplotlib/tests/test_usetex.py b/lib/matplotlib/tests/test_usetex.py
index 25006f174..694a510e7 100644
--- a/lib/matplotlib/tests/test_usetex.py
+++ b/lib/matplotlib/tests/test_usetex.py
@@ -13,7 +13,8 @@ if not mpl.checkdep_usetex(True):
@image_comparison(
baseline_images=['test_usetex'],
extensions=['pdf', 'png'],
- style="mpl20")
+ style="mpl20",
+ tol=21)
def test_usetex():
mpl.rcParams['text.usetex'] = True
fig = plt.figure()
diff --git a/lib/mpl_toolkits/tests/test_axes_grid1.py b/lib/mpl_toolkits/tests/test_axes_grid1.py
index 96830441e..c403b0bf2 100644
--- a/lib/mpl_toolkits/tests/test_axes_grid1.py
+++ b/lib/mpl_toolkits/tests/test_axes_grid1.py
@@ -331,7 +331,7 @@ def test_zooming_with_inverted_axes():
@image_comparison(['anchored_direction_arrows.png'],
- tol=0 if platform.machine() == 'x86_64' else 0.01)
+ tol=0.02)
def test_anchored_direction_arrows():
fig, ax = plt.subplots()
ax.imshow(np.zeros((10, 10)), interpolation='nearest')
diff --git a/lib/mpl_toolkits/tests/test_axisartist_grid_helper_curvelinear.py b/lib/mpl_toolkits/tests/test_axisartist_grid_helper_curvelinear.py
index 05534869a..6e7053722 100644
--- a/lib/mpl_toolkits/tests/test_axisartist_grid_helper_curvelinear.py
+++ b/lib/mpl_toolkits/tests/test_axisartist_grid_helper_curvelinear.py
@@ -17,7 +17,7 @@ from mpl_toolkits.axisartist.grid_helper_curvelinear import \
@image_comparison(['custom_transform.png'], style='default',
- tol=0.03 if platform.machine() == 'x86_64' else 0.034)
+ tol=0.034)
def test_custom_transform():
class MyTransform(Transform):
input_dims = output_dims = 2
diff --git a/lib/mpl_toolkits/tests/test_mplot3d.py b/lib/mpl_toolkits/tests/test_mplot3d.py
index 37532335e..5a2645235 100644
--- a/lib/mpl_toolkits/tests/test_mplot3d.py
+++ b/lib/mpl_toolkits/tests/test_mplot3d.py
@@ -287,7 +287,7 @@ def test_marker_draw_order_view_rotated(fig_test, fig_ref):
ax.view_init(elev=0, azim=azim - 180) # view rotated by 180 degrees
-@mpl3d_image_comparison(['plot_3d_from_2d.png'], tol=0.01)
+@mpl3d_image_comparison(['plot_3d_from_2d.png'], tol=0.012)
def test_plot_3d_from_2d():
fig = plt.figure()
ax = fig.add_subplot(111, projection='3d')
--
2.27.0

View File

@@ -0,0 +1,275 @@
# Copyright 1999-2020 Gentoo Authors
# Distributed under the terms of the GNU General Public License v2
EAPI=7
PYTHON_COMPAT=( python3_{6..9} )
PYTHON_REQ_USE='tk?,threads(+)'
DISTUTILS_USE_SETUPTOOLS=bdepend
inherit distutils-r1 flag-o-matic virtualx toolchain-funcs prefix
FT_PV=2.6.1
DESCRIPTION="Pure python plotting library with matlab like syntax"
HOMEPAGE="https://matplotlib.org/"
SRC_URI="mirror://pypi/${PN:0:1}/${PN}/${P}.tar.gz
test? (
https://downloads.sourceforge.net/project/freetype/freetype2/${FT_PV}/freetype-${FT_PV}.tar.gz
)"
# Main license: matplotlib
# Some modules: BSD
# matplotlib/backends/qt4_editor: MIT
# Fonts: BitstreamVera, OFL-1.1
LICENSE="BitstreamVera BSD matplotlib MIT OFL-1.1"
SLOT="0"
KEYWORDS="~amd64 ~arm ~arm64 ~ppc ~ppc64 ~x86"
IUSE="cairo doc excel examples gtk3 latex qt5 tk wxwidgets"
# internal copy of pycxx highly patched
# dev-python/pycxx
RDEPEND="
>=dev-python/cycler-0.10.0-r1[${PYTHON_USEDEP}]
>=dev-python/kiwisolver-1.2.0[${PYTHON_USEDEP}]
>=dev-python/numpy-1.18.2[${PYTHON_USEDEP}]
>=dev-python/pyparsing-1.5.6[${PYTHON_USEDEP}]
dev-python/python-dateutil:0[${PYTHON_USEDEP}]
>=dev-python/pytz-2019.3[${PYTHON_USEDEP}]
>=dev-python/six-1.14.0[${PYTHON_USEDEP}]
dev-python/versioneer[${PYTHON_USEDEP}]
media-fonts/dejavu
media-fonts/stix-fonts
media-libs/freetype:2
media-libs/libpng:0
>=media-libs/qhull-2013
>=www-servers/tornado-6.0.4[${PYTHON_USEDEP}]
cairo? (
dev-python/cairocffi[${PYTHON_USEDEP}]
)
excel? (
dev-python/xlwt[${PYTHON_USEDEP}]
)
gtk3? (
dev-python/pygobject:3[cairo?,${PYTHON_USEDEP}]
x11-libs/gtk+:3[introspection]
)
latex? (
virtual/latex-base
app-text/dvipng
app-text/ghostscript-gpl
app-text/poppler[utils]
dev-texlive/texlive-fontsrecommended
dev-texlive/texlive-latexextra
dev-texlive/texlive-xetex
)
qt5? (
dev-python/PyQt5[gui,widgets,${PYTHON_USEDEP}]
)
wxwidgets? (
$(python_gen_cond_dep '
dev-python/wxpython:*[${PYTHON_USEDEP}]
' python3_{6,7,8})
)
"
BDEPEND="
${RDEPEND}
virtual/pkgconfig
doc? (
>=app-text/dvipng-1.15-r1
>=dev-python/colorspacious-1.1.2[${PYTHON_USEDEP}]
>=dev-python/pillow-7.1.1[${PYTHON_USEDEP}]
>=dev-python/ipython-1.18.2[${PYTHON_USEDEP}]
>=dev-python/numpydoc-0.9.2[${PYTHON_USEDEP}]
>=sci-libs/scipy-1.4.1[${PYTHON_USEDEP}]
>=dev-python/sphinx-1.3.1[${PYTHON_USEDEP}]
>=dev-python/sphinx-gallery-0.3.1-r1[${PYTHON_USEDEP}]
>=dev-python/xlwt-1.3.0-r1[${PYTHON_USEDEP}]
dev-texlive/texlive-latexextra
dev-texlive/texlive-fontsrecommended
dev-texlive/texlive-latexrecommended
>=media-gfx/graphviz-2.42.3[cairo]
)
test? (
dev-python/flaky[${PYTHON_USEDEP}]
dev-python/mock[${PYTHON_USEDEP}]
dev-python/pygobject:3[cairo?,${PYTHON_USEDEP}]
x11-libs/gtk+:3[introspection]
)
"
# A few C++ source files are written to srcdir.
# Other than that, the ebuild shall be fit for out-of-source build.
DISTUTILS_IN_SOURCE_BUILD=1
distutils_enable_tests pytest
pkg_setup() {
unset DISPLAY # bug #278524
}
use_supported() {
case ${1} in
wxwidgets)
[[ ${EPYTHON} == python3.[678] ]]
;;
esac
return 0
}
use_setup() {
local uword="${2:-${1}}"
if use_supported "${1}" && use "${1}"; then
echo "${uword} = True"
echo "${uword}agg = True"
else
echo "${uword} = False"
echo "${uword}agg = False"
fi
}
python_prepare_all() {
# Generates test failures, but fedora does it
# local PATCHES=(
# "${FILESDIR}"/${P}-unbundle-pycxx.patch
# "${FILESDIR}"/${P}-unbundle-agg.patch
# )
# rm -r agg24 CXX || die
# rm -r agg24 || die
# cat > lib/${PN}/externals/six.py <<-EOF
# from __future__ import absolute_import
# from six import *
# EOF
local PATCHES=(
"${FILESDIR}"/matplotlib-3.3.0-test.patch
)
# requires jupyter-nbconvert
rm lib/matplotlib/tests/test_backend_nbagg.py || die
sed \
-e 's/matplotlib.pyparsing_py[23]/pyparsing/g' \
-i lib/matplotlib/{mathtext,fontconfig_pattern}.py \
|| die "sed pyparsing failed"
sed -e 's:\(@pytest.mark.flaky\)(reruns=3):\1:' \
-i lib/matplotlib/tests/test_*.py || die
hprefixify setupext.py
rm -rf libqhull || die
export XDG_RUNTIME_DIR="${T}/runtime-dir"
mkdir "${XDG_RUNTIME_DIR}" || die
chmod 0700 "${XDG_RUNTIME_DIR}" || die
distutils-r1_python_prepare_all
}
python_configure_all() {
append-flags -fno-strict-aliasing
append-cppflags -DNDEBUG # or get old trying to do triangulation
tc-export PKG_CONFIG
}
python_configure() {
mkdir -p "${BUILD_DIR}" || die
# create setup.cfg (see setup.cfg.template for any changes).
# common switches.
cat > "${BUILD_DIR}"/setup.cfg <<- EOF || die
[directories]
basedirlist = ${EPREFIX}/usr
[provide_packages]
pytz = False
dateutil = False
[libs]
system_freetype = True
system_qhull = True
[packages]
tests = $(usex test True False)
[gui_support]
agg = True
gtk = False
gtkagg = False
pyside = False
pysideagg = False
qt4 = False
qt4agg = False
$(use_setup cairo)
$(use_setup gtk3)
$(use_setup qt5)
$(use_setup tk)
$(use_setup wxwidgets wx)
EOF
if use gtk3 && use cairo; then
echo "gtk3cairo = True" >> "${BUILD_DIR}"/setup.cfg || die
else
echo "gtk3cairo = False" >> "${BUILD_DIR}"/setup.cfg || die
fi
}
wrap_setup() {
local MAKEOPTS=-j1
local -x MPLSETUPCFG="${BUILD_DIR}"/setup.cfg
"$@"
}
python_compile() {
wrap_setup distutils-r1_python_compile --build-lib="${BUILD_DIR}"/lib
}
python_compile_all() {
if use doc; then
cd doc || die
# necessary for in-source build
local -x PYTHONPATH="${BUILD_DIR}"/build/lib:${PYTHONPATH}
VARTEXFONTS="${T}"/fonts \
emake SPHINXOPTS= O=-Dplot_formats=png:100 html
fi
}
src_test() {
virtx distutils-r1_src_test
}
python_test() {
# we need to rebuild mpl against bundled freetype, otherwise
# over 1000 tests will fail because of mismatched font rendering
grep -v system_freetype "${BUILD_DIR}"/setup.cfg \
> "${BUILD_DIR}"/test-setup.cfg || die
local -x MPLSETUPCFG="${BUILD_DIR}"/test-setup.cfg
ln -s "${WORKDIR}/freetype-${FT_PV}" "${BUILD_DIR}" || die
distutils-r1_python_compile -j1 --build-lib="${BUILD_DIR}"/test-lib
local -x PYTHONPATH=${BUILD_DIR}/test-lib:${PYTHONPATH}
"${EPYTHON}" -c "import sys, matplotlib as m; sys.exit(m.test(verbosity=2))" || die
}
python_install() {
wrap_setup distutils-r1_python_install
# mpl_toolkits namespace
python_moduleinto mpl_toolkits
python_domodule lib/mpl_toolkits/__init__.py
}
python_install_all() {
use doc && local HTML_DOCS=( doc/build/html/. )
distutils-r1_python_install_all
if use examples; then
dodoc -r examples
docompress -x /usr/share/doc/${PF}/examples
fi
find "${D}" -name '*.pth' -delete || die
}