Gentoo Archives: gentoo-commits

From: "Michał Górny" <mgorny@g.o>
To: gentoo-commits@l.g.o
Subject: [gentoo-commits] repo/gentoo:master commit in: dev-python/matplotlib/files/, dev-python/matplotlib/
Date: Tue, 03 May 2022 10:20:10
Message-Id: 1651573200.dd9857e36002f18fd68211cf7e523323eb8da121.mgorny@gentoo
1 commit: dd9857e36002f18fd68211cf7e523323eb8da121
2 Author: Michał Górny <mgorny <AT> gentoo <DOT> org>
3 AuthorDate: Tue May 3 07:02:36 2022 +0000
4 Commit: Michał Górny <mgorny <AT> gentoo <DOT> org>
5 CommitDate: Tue May 3 10:20:00 2022 +0000
6 URL: https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=dd9857e3
7
8 dev-python/matplotlib: Bump to 3.5.2
9
10 Signed-off-by: Michał Górny <mgorny <AT> gentoo.org>
11
12 dev-python/matplotlib/Manifest | 1 +
13 .../matplotlib/files/matplotlib-3.5.2-test.patch | 261 ++++++++++++++++++
14 dev-python/matplotlib/matplotlib-3.5.2.ebuild | 294 +++++++++++++++++++++
15 3 files changed, 556 insertions(+)
16
17 diff --git a/dev-python/matplotlib/Manifest b/dev-python/matplotlib/Manifest
18 index bcd051ad24c7..d3a94af7e8db 100644
19 --- a/dev-python/matplotlib/Manifest
20 +++ b/dev-python/matplotlib/Manifest
21 @@ -1,3 +1,4 @@
22 DIST freetype-2.6.1.tar.gz 2302080 BLAKE2B 6a5fb98e5fa6cf4b7d7533ad44e364227d8c2f7dded4c552d6e22e204c32b7858f20d41d1e809ecdad6e5353d6cec81bea0e0b06a4533363a41ecab83ce3f7ca SHA512 ff2daed64d712737085924c50e75862fafbcbb24eef6d72dac9eaae63bb656d7245397fd828f5d3e47ac847f7ff83d73dedfdd61fde1f7d6e0f0cdeb49bcf83b
23 DIST matplotlib-3.4.3.tar.gz 37850796 BLAKE2B 15b40da8f6973ece4a91fffb5caf249cb8642263bfc2a784ec482bfaad250b6d3beffb9d2ba8a03e5fa10abab02b0e35728a8499ccb870aca06df57c5c1f91f4 SHA512 c2fe54e7517a1417aa8e55596e83edd090534c07f22882634d6ba0a07196441b5bbdd15958473805d8e8871b1b73380487aff3224294d472cd6122490c783145
24 DIST matplotlib-3.5.1.tar.gz 35320470 BLAKE2B ebf69b62ac587c61ecf8442abaab302019f63a3c9d8db6f7f7fb32f4d14da554fd8305ea6dfed2ff86a5af4e7e4d2b81f14802692fe50c986f7da8545bd26c00 SHA512 a317dbd748e5fc1fafcf80020cb6d38a8888431487beded97acd59d759e67e54f59506b642e4a03d4351c1ac050d15e3f2e2b5443433debc78ddad52881c8d82
25 +DIST matplotlib-3.5.2.tar.gz 35210006 BLAKE2B e3f90a0cf1d28f041a8cdd6920a8a4efe16169bb4acf85f7b2562196db306eeb692218728ea33c7b62214e7894e83a104954cbef38c45ccbb4f630bd35c0c36b SHA512 32844dfa85dbc43360c1773d748a58d2ab089111c51c825da62956c778a0eeaf10ca33a5c6c094295388a80d5873a2e1b17484e02b653e9e8e5ba98659329974
26
27 diff --git a/dev-python/matplotlib/files/matplotlib-3.5.2-test.patch b/dev-python/matplotlib/files/matplotlib-3.5.2-test.patch
28 new file mode 100644
29 index 000000000000..4b54480c5adf
30 --- /dev/null
31 +++ b/dev-python/matplotlib/files/matplotlib-3.5.2-test.patch
32 @@ -0,0 +1,261 @@
33 +From ea4bae5e68e3065ca159ea309a0f3325a06e7f35 Mon Sep 17 00:00:00 2001
34 +From: =?UTF-8?q?Micha=C5=82=20G=C3=B3rny?= <mgorny@g.o>
35 +Date: Fri, 26 Mar 2021 13:42:49 +0100
36 +Subject: [PATCH] Increase image comparison limits
37 +
38 +Most of the tests require exact match which apparently doesn't always
39 +happen in non-pristine environments. Some of them have very big
40 +differences due to texlive font rendering changes.
41 +---
42 + lib/matplotlib/tests/test_arrow_patches.py | 6 +++---
43 + lib/matplotlib/tests/test_axes.py | 4 ++--
44 + lib/matplotlib/tests/test_backend_pgf.py | 2 +-
45 + lib/matplotlib/tests/test_colorbar.py | 2 +-
46 + lib/matplotlib/tests/test_contour.py | 2 +-
47 + lib/matplotlib/tests/test_figure.py | 5 +++--
48 + lib/matplotlib/tests/test_image.py | 2 +-
49 + lib/matplotlib/tests/test_legend.py | 6 +++---
50 + lib/matplotlib/tests/test_lines.py | 3 ++-
51 + lib/matplotlib/tests/test_streamplot.py | 3 ++-
52 + lib/matplotlib/tests/test_units.py | 4 ++--
53 + lib/matplotlib/tests/test_usetex.py | 1 +
54 + lib/mpl_toolkits/tests/test_axes_grid1.py | 2 +-
55 + 13 files changed, 23 insertions(+), 19 deletions(-)
56 +
57 +diff --git a/lib/matplotlib/tests/test_arrow_patches.py b/lib/matplotlib/tests/test_arrow_patches.py
58 +index 8d573b4adb..dfc42efcb9 100644
59 +--- a/lib/matplotlib/tests/test_arrow_patches.py
60 ++++ b/lib/matplotlib/tests/test_arrow_patches.py
61 +@@ -67,7 +67,7 @@ def __prepare_fancyarrow_dpi_cor_test():
62 +
63 +
64 + @image_comparison(['fancyarrow_dpi_cor_100dpi.png'], remove_text=True,
65 +- tol=0 if platform.machine() == 'x86_64' else 0.02,
66 ++ tol=0.015 if platform.machine() == 'x86_64' else 0.02,
67 + savefig_kwarg=dict(dpi=100))
68 + def test_fancyarrow_dpi_cor_100dpi():
69 + """
70 +@@ -82,7 +82,7 @@ def test_fancyarrow_dpi_cor_100dpi():
71 +
72 +
73 + @image_comparison(['fancyarrow_dpi_cor_200dpi.png'], remove_text=True,
74 +- tol=0 if platform.machine() == 'x86_64' else 0.02,
75 ++ tol=0.018 if platform.machine() == 'x86_64' else 0.02,
76 + savefig_kwarg=dict(dpi=200))
77 + def test_fancyarrow_dpi_cor_200dpi():
78 + """
79 +@@ -115,7 +115,7 @@ def test_fancyarrow_dash():
80 +
81 +
82 + @image_comparison(['arrow_styles.png'], style='mpl20', remove_text=True,
83 +- tol=0 if platform.machine() == 'x86_64' else 0.005)
84 ++ tol=0.005)
85 + def test_arrow_styles():
86 + styles = mpatches.ArrowStyle.get_styles()
87 +
88 +diff --git a/lib/matplotlib/tests/test_axes.py b/lib/matplotlib/tests/test_axes.py
89 +index eb4c34382b..cca73a23f9 100644
90 +--- a/lib/matplotlib/tests/test_axes.py
91 ++++ b/lib/matplotlib/tests/test_axes.py
92 +@@ -918,7 +918,7 @@ def test_imshow():
93 + ax.imshow("r", data=data)
94 +
95 +
96 +-@image_comparison(['imshow_clip'], style='mpl20')
97 ++@image_comparison(['imshow_clip'], style='mpl20', tol=1.24)
98 + def test_imshow_clip():
99 + # As originally reported by Gellule Xg <gellule.xg@××××.fr>
100 + # use former defaults to match existing baseline image
101 +@@ -4231,7 +4231,7 @@ def test_vertex_markers():
102 +
103 +
104 + @image_comparison(['vline_hline_zorder', 'errorbar_zorder'],
105 +- tol=0 if platform.machine() == 'x86_64' else 0.02)
106 ++ tol=0.015 if platform.machine() == 'x86_64' else 0.02)
107 + def test_eb_line_zorder():
108 + x = list(range(10))
109 +
110 +diff --git a/lib/matplotlib/tests/test_backend_pgf.py b/lib/matplotlib/tests/test_backend_pgf.py
111 +index 9b5b0b28ee..a374be0333 100644
112 +--- a/lib/matplotlib/tests/test_backend_pgf.py
113 ++++ b/lib/matplotlib/tests/test_backend_pgf.py
114 +@@ -80,7 +80,7 @@ def test_common_texification(plain_text, escaped_text):
115 + # test compiling a figure to pdf with xelatex
116 + @needs_xelatex
117 + @pytest.mark.backend('pgf')
118 +-@image_comparison(['pgf_xelatex.pdf'], style='default')
119 ++@image_comparison(['pgf_xelatex.pdf'], style='default', tol=0.8)
120 + def test_xelatex():
121 + rc_xelatex = {'font.family': 'serif',
122 + 'pgf.rcfonts': False}
123 +diff --git a/lib/matplotlib/tests/test_colorbar.py b/lib/matplotlib/tests/test_colorbar.py
124 +index 304056f6d1..9934bac550 100644
125 +--- a/lib/matplotlib/tests/test_colorbar.py
126 ++++ b/lib/matplotlib/tests/test_colorbar.py
127 +@@ -218,7 +218,7 @@ def test_colorbar_single_ax_panchor_false():
128 + plt.colorbar(panchor=False)
129 +
130 +
131 +-@image_comparison(['contour_colorbar.png'], remove_text=True)
132 ++@image_comparison(['contour_colorbar.png'], remove_text=True, tol=0.01)
133 + def test_contour_colorbar():
134 + fig, ax = plt.subplots(figsize=(4, 2))
135 + data = np.arange(1200).reshape(30, 40) - 500
136 +diff --git a/lib/matplotlib/tests/test_contour.py b/lib/matplotlib/tests/test_contour.py
137 +index 10fb011166..f49fb25dc8 100644
138 +--- a/lib/matplotlib/tests/test_contour.py
139 ++++ b/lib/matplotlib/tests/test_contour.py
140 +@@ -345,7 +345,7 @@ def test_contourf_log_extension():
141 +
142 +
143 + @image_comparison(['contour_addlines.png'],
144 +- remove_text=True, style='mpl20', tol=0.03)
145 ++ remove_text=True, style='mpl20', tol=0.1)
146 + # tolerance is because image changed minutely when tick finding on
147 + # colorbars was cleaned up...
148 + def test_contour_addlines():
149 +diff --git a/lib/matplotlib/tests/test_figure.py b/lib/matplotlib/tests/test_figure.py
150 +index 1e076bd64f..11c2668d33 100644
151 +--- a/lib/matplotlib/tests/test_figure.py
152 ++++ b/lib/matplotlib/tests/test_figure.py
153 +@@ -23,7 +23,7 @@ import matplotlib.gridspec as gridspec
154 +
155 +
156 + @image_comparison(['figure_align_labels'], extensions=['png', 'svg'],
157 +- tol=0 if platform.machine() == 'x86_64' else 0.01)
158 ++ tol=0.02)
159 + def test_align_labels():
160 + fig = plt.figure(tight_layout=True)
161 + gs = gridspec.GridSpec(3, 3)
162 +@@ -1124,7 +1124,8 @@ def test_subfigure_tightbbox():
163 +
164 + @image_comparison(['test_subfigure_ss.png'], style='mpl20',
165 + savefig_kwarg={'facecolor': 'teal'},
166 +- remove_text=False)
167 ++ remove_text=False,
168 ++ tol=0.013)
169 + def test_subfigure_ss():
170 + # test assigning the subfigure via subplotspec
171 + np.random.seed(19680801)
172 +diff --git a/lib/matplotlib/tests/test_image.py b/lib/matplotlib/tests/test_image.py
173 +index 719b190578..ee2263a88e 100644
174 +--- a/lib/matplotlib/tests/test_image.py
175 ++++ b/lib/matplotlib/tests/test_image.py
176 +@@ -1324,7 +1324,7 @@ def test_nonuniform_and_pcolor():
177 +
178 +
179 + @image_comparison(["rgba_antialias.png"], style="mpl20",
180 +- remove_text=True)
181 ++ remove_text=True, tol=0.005)
182 + def test_rgba_antialias():
183 + fig, axs = plt.subplots(2, 2, figsize=(3.5, 3.5), sharex=False,
184 + sharey=False, constrained_layout=True)
185 +diff --git a/lib/matplotlib/tests/test_legend.py b/lib/matplotlib/tests/test_legend.py
186 +index fe8a8dd5f6..43fbda8ab0 100644
187 +--- a/lib/matplotlib/tests/test_legend.py
188 ++++ b/lib/matplotlib/tests/test_legend.py
189 +@@ -102,7 +102,7 @@ def test_multiple_keys():
190 +
191 +
192 + @image_comparison(['rgba_alpha.png'], remove_text=True,
193 +- tol=0 if platform.machine() == 'x86_64' else 0.01)
194 ++ tol=0.02)
195 + def test_alpha_rgba():
196 + fig, ax = plt.subplots()
197 + ax.plot(range(10), lw=5)
198 +@@ -111,7 +111,7 @@ def test_alpha_rgba():
199 +
200 +
201 + @image_comparison(['rcparam_alpha.png'], remove_text=True,
202 +- tol=0 if platform.machine() == 'x86_64' else 0.01)
203 ++ tol=0.02)
204 + def test_alpha_rcparam():
205 + fig, ax = plt.subplots()
206 + ax.plot(range(10), lw=5)
207 +@@ -137,7 +137,7 @@ def test_fancy():
208 +
209 +
210 + @image_comparison(['framealpha'], remove_text=True,
211 +- tol=0 if platform.machine() == 'x86_64' else 0.02)
212 ++ tol=0.02)
213 + def test_framealpha():
214 + x = np.linspace(1, 100, 100)
215 + y = x
216 +diff --git a/lib/matplotlib/tests/test_lines.py b/lib/matplotlib/tests/test_lines.py
217 +index f6917a134b..4a14abb74d 100644
218 +--- a/lib/matplotlib/tests/test_lines.py
219 ++++ b/lib/matplotlib/tests/test_lines.py
220 +@@ -162,7 +162,8 @@ def test_set_drawstyle():
221 + assert len(line.get_path().vertices) == len(x)
222 +
223 +
224 +-@image_comparison(['line_collection_dashes'], remove_text=True, style='mpl20')
225 ++@image_comparison(['line_collection_dashes'], remove_text=True, style='mpl20',
226 ++ tol=0.58)
227 + def test_set_line_coll_dash_image():
228 + fig, ax = plt.subplots()
229 + np.random.seed(0)
230 +diff --git a/lib/matplotlib/tests/test_streamplot.py b/lib/matplotlib/tests/test_streamplot.py
231 +index c8824feb06..081e8c0559 100644
232 +--- a/lib/matplotlib/tests/test_streamplot.py
233 ++++ b/lib/matplotlib/tests/test_streamplot.py
234 +@@ -34,7 +34,8 @@ def test_startpoints():
235 + plt.plot(start_x, start_y, 'ok')
236 +
237 +
238 +-@image_comparison(['streamplot_colormap'], remove_text=True, style='mpl20')
239 ++@image_comparison(['streamplot_colormap'], remove_text=True, style='mpl20',
240 ++ tol=0.002)
241 + def test_colormap():
242 + X, Y, U, V = velocity_field()
243 + plt.streamplot(X, Y, U, V, color=U, density=0.6, linewidth=2,
244 +diff --git a/lib/matplotlib/tests/test_units.py b/lib/matplotlib/tests/test_units.py
245 +index a6f6b44c97..ab5ad8b5cf 100644
246 +--- a/lib/matplotlib/tests/test_units.py
247 ++++ b/lib/matplotlib/tests/test_units.py
248 +@@ -76,7 +76,7 @@ def quantity_converter():
249 + # Tests that the conversion machinery works properly for classes that
250 + # work as a facade over numpy arrays (like pint)
251 + @image_comparison(['plot_pint.png'], remove_text=False, style='mpl20',
252 +- tol=0 if platform.machine() == 'x86_64' else 0.01)
253 ++ tol=0.002 if platform.machine() == 'x86_64' else 0.01)
254 + def test_numpy_facade(quantity_converter):
255 + # use former defaults to match existing baseline image
256 + plt.rcParams['axes.formatter.limits'] = -7, 7
257 +@@ -103,7 +103,7 @@ def test_numpy_facade(quantity_converter):
258 +
259 + # Tests gh-8908
260 + @image_comparison(['plot_masked_units.png'], remove_text=True, style='mpl20',
261 +- tol=0 if platform.machine() == 'x86_64' else 0.01)
262 ++ tol=0.02)
263 + def test_plot_masked_units():
264 + data = np.linspace(-5, 5)
265 + data_masked = np.ma.array(data, mask=(data > -2) & (data < 2))
266 +diff --git a/lib/matplotlib/tests/test_usetex.py b/lib/matplotlib/tests/test_usetex.py
267 +index 12557cf847..25b65ead67 100644
268 +--- a/lib/matplotlib/tests/test_usetex.py
269 ++++ b/lib/matplotlib/tests/test_usetex.py
270 +@@ -11,6 +11,7 @@ if not mpl.checkdep_usetex(True):
271 + pytestmark = pytest.mark.skip('Missing TeX of Ghostscript or dvipng')
272 +
273 +
274 ++@×××××××××××.skip(reason="TODO: broken")
275 + @image_comparison(
276 + baseline_images=['test_usetex'],
277 + extensions=['pdf', 'png'],
278 +diff --git a/lib/mpl_toolkits/tests/test_axes_grid1.py b/lib/mpl_toolkits/tests/test_axes_grid1.py
279 +index f8902ca72f..323579b8b6 100644
280 +--- a/lib/mpl_toolkits/tests/test_axes_grid1.py
281 ++++ b/lib/mpl_toolkits/tests/test_axes_grid1.py
282 +@@ -336,7 +336,7 @@ def test_zooming_with_inverted_axes():
283 +
284 +
285 + @image_comparison(['anchored_direction_arrows.png'],
286 +- tol=0 if platform.machine() == 'x86_64' else 0.01)
287 ++ tol=0.02)
288 + def test_anchored_direction_arrows():
289 + fig, ax = plt.subplots()
290 + ax.imshow(np.zeros((10, 10)), interpolation='nearest')
291 +--
292 +2.35.1
293 +
294
295 diff --git a/dev-python/matplotlib/matplotlib-3.5.2.ebuild b/dev-python/matplotlib/matplotlib-3.5.2.ebuild
296 new file mode 100644
297 index 000000000000..b34037d20297
298 --- /dev/null
299 +++ b/dev-python/matplotlib/matplotlib-3.5.2.ebuild
300 @@ -0,0 +1,294 @@
301 +# Copyright 1999-2022 Gentoo Authors
302 +# Distributed under the terms of the GNU General Public License v2
303 +
304 +EAPI=8
305 +
306 +PYTHON_COMPAT=( python3_{8..10} )
307 +PYTHON_REQ_USE='tk?,threads(+)'
308 +
309 +inherit distutils-r1 flag-o-matic virtualx toolchain-funcs prefix
310 +
311 +FT_PV=2.6.1
312 +DESCRIPTION="Pure python plotting library with matlab like syntax"
313 +HOMEPAGE="
314 + https://matplotlib.org/
315 + https://github.com/matplotlib/matplotlib/
316 + https://pypi.org/project/matplotlib/
317 +"
318 +SRC_URI="
319 + mirror://pypi/${PN:0:1}/${PN}/${P}.tar.gz
320 + test? (
321 + https://downloads.sourceforge.net/project/freetype/freetype2/${FT_PV}/freetype-${FT_PV}.tar.gz
322 + )
323 +"
324 +
325 +# Main license: matplotlib
326 +# Some modules: BSD
327 +# matplotlib/backends/qt4_editor: MIT
328 +# Fonts: BitstreamVera, OFL-1.1
329 +LICENSE="BitstreamVera BSD matplotlib MIT OFL-1.1"
330 +SLOT="0"
331 +KEYWORDS="~amd64 ~arm ~arm64 ~hppa ~ia64 ~ppc ~ppc64 ~riscv ~s390 ~sparc ~x86"
332 +IUSE="cairo doc excel examples gtk3 latex qt5 tk webagg wxwidgets"
333 +
334 +# internal copy of pycxx highly patched
335 +# dev-python/pycxx
336 +RDEPEND="
337 + dev-python/certifi[${PYTHON_USEDEP}]
338 + >=dev-python/cycler-0.10.0-r1[${PYTHON_USEDEP}]
339 + >=dev-python/fonttools-4.22.0[${PYTHON_USEDEP}]
340 + >=dev-python/kiwisolver-1.2.0[${PYTHON_USEDEP}]
341 + >=dev-python/numpy-1.18.2[${PYTHON_USEDEP}]
342 + >=dev-python/packaging-20.0[${PYTHON_USEDEP}]
343 + >=dev-python/pillow-7.1.1[jpeg,${PYTHON_USEDEP}]
344 + >=dev-python/pyparsing-2.2.1[${PYTHON_USEDEP}]
345 + >=dev-python/python-dateutil-2.7[${PYTHON_USEDEP}]
346 + >=dev-python/pytz-2019.3[${PYTHON_USEDEP}]
347 + >=dev-python/six-1.14.0[${PYTHON_USEDEP}]
348 + dev-python/versioneer[${PYTHON_USEDEP}]
349 + media-fonts/dejavu
350 + media-fonts/stix-fonts
351 + media-libs/freetype:2
352 + media-libs/libpng:0
353 + >=media-libs/qhull-2013:=
354 + virtual/imagemagick-tools[jpeg,tiff]
355 + cairo? (
356 + dev-python/cairocffi[${PYTHON_USEDEP}]
357 + )
358 + excel? (
359 + dev-python/xlwt[${PYTHON_USEDEP}]
360 + )
361 + gtk3? (
362 + >=dev-python/pygobject-3.40.1-r1:3[cairo?,${PYTHON_USEDEP}]
363 + x11-libs/gtk+:3[introspection]
364 + )
365 + latex? (
366 + virtual/latex-base
367 + app-text/dvipng
368 + app-text/ghostscript-gpl
369 + app-text/poppler[utils]
370 + dev-texlive/texlive-fontsrecommended
371 + dev-texlive/texlive-latexextra
372 + dev-texlive/texlive-luatex
373 + dev-texlive/texlive-xetex
374 + )
375 + qt5? (
376 + dev-python/PyQt5[gui,widgets,${PYTHON_USEDEP}]
377 + )
378 + webagg? (
379 + >=www-servers/tornado-6.0.4[${PYTHON_USEDEP}]
380 + )
381 + wxwidgets? (
382 + dev-python/wxpython:*[${PYTHON_USEDEP}]
383 + )
384 +"
385 +
386 +BDEPEND="
387 + ${RDEPEND}
388 + dev-python/setuptools_scm[${PYTHON_USEDEP}]
389 + dev-python/setuptools_scm_git_archive[${PYTHON_USEDEP}]
390 + virtual/pkgconfig
391 + doc? (
392 + >=app-text/dvipng-1.15-r1
393 + >=dev-python/colorspacious-1.1.2[${PYTHON_USEDEP}]
394 + >=dev-python/ipython-1.18.2[${PYTHON_USEDEP}]
395 + >=dev-python/numpydoc-0.9.2[${PYTHON_USEDEP}]
396 + >=dev-python/scipy-1.4.1[${PYTHON_USEDEP}]
397 + >=dev-python/sphinx-1.3.1[${PYTHON_USEDEP}]
398 + >=dev-python/sphinx-gallery-0.3.1-r1[${PYTHON_USEDEP}]
399 + >=dev-python/xlwt-1.3.0-r1[${PYTHON_USEDEP}]
400 + virtual/latex-base
401 + dev-texlive/texlive-latexextra
402 + dev-texlive/texlive-fontsrecommended
403 + dev-texlive/texlive-latexrecommended
404 + dev-texlive/texlive-luatex
405 + dev-texlive/texlive-xetex
406 + >=media-gfx/graphviz-2.42.3[cairo]
407 + )
408 + test? (
409 + dev-python/flaky[${PYTHON_USEDEP}]
410 + dev-python/mock[${PYTHON_USEDEP}]
411 + dev-python/psutil[${PYTHON_USEDEP}]
412 + >=dev-python/pygobject-3.40.1-r1:3[cairo?,${PYTHON_USEDEP}]
413 + >=www-servers/tornado-6.0.4[${PYTHON_USEDEP}]
414 + x11-libs/gtk+:3[introspection]
415 + )
416 +"
417 +
418 +# A few C++ source files are written to srcdir.
419 +# Other than that, the ebuild shall be fit for out-of-source build.
420 +DISTUTILS_IN_SOURCE_BUILD=1
421 +
422 +distutils_enable_tests pytest
423 +
424 +pkg_setup() {
425 + unset DISPLAY # bug #278524
426 +}
427 +
428 +use_supported() {
429 + case ${1} in
430 + wxwidgets)
431 + [[ ${EPYTHON} == python3.[678] ]]
432 + ;;
433 + esac
434 +
435 + return 0
436 +}
437 +
438 +use_setup() {
439 + local uword="${2:-${1}}"
440 + if use_supported "${1}" && use "${1}"; then
441 + echo "${uword} = True"
442 + echo "${uword}agg = True"
443 + else
444 + echo "${uword} = False"
445 + echo "${uword}agg = False"
446 + fi
447 +}
448 +
449 +python_prepare_all() {
450 +# Generates test failures, but fedora does it
451 +# local PATCHES=(
452 +# "${FILESDIR}"/${P}-unbundle-pycxx.patch
453 +# "${FILESDIR}"/${P}-unbundle-agg.patch
454 +# )
455 +# rm -r agg24 CXX || die
456 +# rm -r agg24 || die
457 +
458 +# cat > lib/${PN}/externals/six.py <<-EOF
459 +# from __future__ import absolute_import
460 +# from six import *
461 +# EOF
462 +
463 + local PATCHES=(
464 + "${FILESDIR}"/matplotlib-3.3.3-disable-lto.patch
465 + "${FILESDIR}"/matplotlib-3.5.2-test.patch
466 + )
467 +
468 + # requires jupyter-nbconvert
469 + rm lib/matplotlib/tests/test_backend_nbagg.py || die
470 +
471 + sed \
472 + -e 's/matplotlib.pyparsing_py[23]/pyparsing/g' \
473 + -i lib/matplotlib/{mathtext,fontconfig_pattern}.py \
474 + || die "sed pyparsing failed"
475 +
476 + sed -e 's:\(@pytest.mark.flaky\)(reruns=3):\1:' \
477 + -i lib/matplotlib/tests/test_*.py || die
478 +
479 + hprefixify setupext.py
480 +
481 + rm -rf libqhull || die
482 +
483 + export XDG_RUNTIME_DIR="${T}/runtime-dir"
484 + mkdir "${XDG_RUNTIME_DIR}" || die
485 + chmod 0700 "${XDG_RUNTIME_DIR}" || die
486 +
487 + distutils-r1_python_prepare_all
488 +}
489 +
490 +python_configure_all() {
491 + append-flags -fno-strict-aliasing
492 + append-cppflags -DNDEBUG # or get old trying to do triangulation
493 + tc-export PKG_CONFIG
494 +}
495 +
496 +python_configure() {
497 + mkdir -p "${BUILD_DIR}" || die
498 +
499 + # create setup.cfg (see setup.cfg.template for any changes).
500 +
501 + # common switches.
502 + cat > "${BUILD_DIR}"/setup.cfg <<- EOF || die
503 + [directories]
504 + basedirlist = ${EPREFIX}/usr
505 + [provide_packages]
506 + pytz = False
507 + dateutil = False
508 + [libs]
509 + system_freetype = True
510 + system_qhull = True
511 + [packages]
512 + tests = $(usex test True False)
513 + [gui_support]
514 + agg = True
515 + gtk = False
516 + gtkagg = False
517 + macosx = False
518 + pyside = False
519 + pysideagg = False
520 + qt4 = False
521 + qt4agg = False
522 + $(use_setup cairo)
523 + $(use_setup gtk3)
524 + $(use_setup qt5)
525 + $(use_setup tk)
526 + $(use_setup wxwidgets wx)
527 + EOF
528 +
529 + if use gtk3 && use cairo; then
530 + echo "gtk3cairo = True" >> "${BUILD_DIR}"/setup.cfg || die
531 + else
532 + echo "gtk3cairo = False" >> "${BUILD_DIR}"/setup.cfg || die
533 + fi
534 +}
535 +
536 +wrap_setup() {
537 + local MAKEOPTS=-j1
538 + local -x MPLSETUPCFG="${BUILD_DIR}"/setup.cfg
539 + "$@"
540 +}
541 +
542 +python_compile() {
543 + wrap_setup distutils-r1_python_compile --build-lib="${BUILD_DIR}"/lib
544 +}
545 +
546 +python_compile_all() {
547 + if use doc; then
548 + cd doc || die
549 +
550 + # necessary for in-source build
551 + local -x PYTHONPATH="${BUILD_DIR}"/build/lib:${PYTHONPATH}
552 +
553 + VARTEXFONTS="${T}"/fonts \
554 + emake SPHINXOPTS= O=-Dplot_formats=png:100 html
555 + fi
556 +}
557 +
558 +src_test() {
559 + virtx distutils-r1_src_test
560 +}
561 +
562 +python_test() {
563 + # we need to rebuild mpl against bundled freetype, otherwise
564 + # over 1000 tests will fail because of mismatched font rendering
565 + grep -v system_freetype "${BUILD_DIR}"/setup.cfg \
566 + > "${BUILD_DIR}"/test-setup.cfg || die
567 + local -x MPLSETUPCFG="${BUILD_DIR}"/test-setup.cfg
568 + ln -s "${WORKDIR}/freetype-${FT_PV}" "${BUILD_DIR}" || die
569 + distutils-r1_python_compile -j1 --build-lib="${BUILD_DIR}"/test-lib
570 + local -x PYTHONPATH=${BUILD_DIR}/test-lib:${PYTHONPATH}
571 +
572 + "${EPYTHON}" -c "import sys, matplotlib as m; sys.exit(m.test(argv=['-m', 'not network'], verbosity=2))" || die
573 +}
574 +
575 +python_install() {
576 + wrap_setup distutils-r1_python_install
577 +
578 + # mpl_toolkits namespace
579 + python_moduleinto mpl_toolkits
580 + python_domodule lib/mpl_toolkits/__init__.py
581 +}
582 +
583 +python_install_all() {
584 + use doc && local HTML_DOCS=( doc/build/html/. )
585 +
586 + distutils-r1_python_install_all
587 +
588 + if use examples; then
589 + dodoc -r examples
590 + docompress -x /usr/share/doc/${PF}/examples
591 + fi
592 +
593 + find "${D}" -name '*.pth' -delete || die
594 +}