1 |
commit: 36b99d67e4a9c7b9ff4e46c614961140b48ec05f |
2 |
Author: Michał Górny <mgorny <AT> gentoo <DOT> org> |
3 |
AuthorDate: Tue May 3 13:13:56 2022 +0000 |
4 |
Commit: Michał Górny <mgorny <AT> gentoo <DOT> org> |
5 |
CommitDate: Tue May 3 14:11:12 2022 +0000 |
6 |
URL: https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=36b99d67 |
7 |
|
8 |
dev-python/matplotlib: Switch to PEP517 build |
9 |
|
10 |
Signed-off-by: Michał Górny <mgorny <AT> gentoo.org> |
11 |
|
12 |
dev-python/matplotlib/matplotlib-3.5.2-r1.ebuild | 273 +++++++++++++++++++++++ |
13 |
1 file changed, 273 insertions(+) |
14 |
|
15 |
diff --git a/dev-python/matplotlib/matplotlib-3.5.2-r1.ebuild b/dev-python/matplotlib/matplotlib-3.5.2-r1.ebuild |
16 |
new file mode 100644 |
17 |
index 000000000000..b1639b00cc3c |
18 |
--- /dev/null |
19 |
+++ b/dev-python/matplotlib/matplotlib-3.5.2-r1.ebuild |
20 |
@@ -0,0 +1,273 @@ |
21 |
+# Copyright 1999-2022 Gentoo Authors |
22 |
+# Distributed under the terms of the GNU General Public License v2 |
23 |
+ |
24 |
+EAPI=8 |
25 |
+ |
26 |
+DISTUTILS_USE_PEP517=setuptools |
27 |
+PYTHON_COMPAT=( python3_{8..10} ) |
28 |
+PYTHON_REQ_USE='tk?,threads(+)' |
29 |
+ |
30 |
+inherit distutils-r1 flag-o-matic multiprocessing prefix toolchain-funcs \ |
31 |
+ virtualx |
32 |
+ |
33 |
+FT_PV=2.6.1 |
34 |
+DESCRIPTION="Pure python plotting library with matlab like syntax" |
35 |
+HOMEPAGE=" |
36 |
+ https://matplotlib.org/ |
37 |
+ https://github.com/matplotlib/matplotlib/ |
38 |
+ https://pypi.org/project/matplotlib/ |
39 |
+" |
40 |
+SRC_URI=" |
41 |
+ mirror://pypi/${PN:0:1}/${PN}/${P}.tar.gz |
42 |
+ test? ( |
43 |
+ https://downloads.sourceforge.net/project/freetype/freetype2/${FT_PV}/freetype-${FT_PV}.tar.gz |
44 |
+ ) |
45 |
+" |
46 |
+ |
47 |
+# Main license: matplotlib |
48 |
+# Some modules: BSD |
49 |
+# matplotlib/backends/qt4_editor: MIT |
50 |
+# Fonts: BitstreamVera, OFL-1.1 |
51 |
+LICENSE="BitstreamVera BSD matplotlib MIT OFL-1.1" |
52 |
+SLOT="0" |
53 |
+KEYWORDS="~amd64 ~arm ~arm64 ~hppa ~ia64 ~ppc ~ppc64 ~riscv ~s390 ~sparc ~x86" |
54 |
+IUSE="cairo doc excel examples gtk3 latex qt5 tk webagg wxwidgets" |
55 |
+ |
56 |
+# internal copy of pycxx highly patched |
57 |
+# dev-python/pycxx |
58 |
+RDEPEND=" |
59 |
+ dev-python/certifi[${PYTHON_USEDEP}] |
60 |
+ >=dev-python/cycler-0.10.0-r1[${PYTHON_USEDEP}] |
61 |
+ >=dev-python/fonttools-4.22.0[${PYTHON_USEDEP}] |
62 |
+ >=dev-python/kiwisolver-1.2.0[${PYTHON_USEDEP}] |
63 |
+ >=dev-python/numpy-1.18.2[${PYTHON_USEDEP}] |
64 |
+ >=dev-python/packaging-20.0[${PYTHON_USEDEP}] |
65 |
+ >=dev-python/pillow-7.1.1[jpeg,${PYTHON_USEDEP}] |
66 |
+ >=dev-python/pyparsing-2.2.1[${PYTHON_USEDEP}] |
67 |
+ >=dev-python/python-dateutil-2.7[${PYTHON_USEDEP}] |
68 |
+ >=dev-python/pytz-2019.3[${PYTHON_USEDEP}] |
69 |
+ >=dev-python/six-1.14.0[${PYTHON_USEDEP}] |
70 |
+ dev-python/versioneer[${PYTHON_USEDEP}] |
71 |
+ media-fonts/dejavu |
72 |
+ media-fonts/stix-fonts |
73 |
+ media-libs/freetype:2 |
74 |
+ media-libs/libpng:0 |
75 |
+ >=media-libs/qhull-2013:= |
76 |
+ virtual/imagemagick-tools[jpeg,tiff] |
77 |
+ cairo? ( |
78 |
+ dev-python/cairocffi[${PYTHON_USEDEP}] |
79 |
+ ) |
80 |
+ excel? ( |
81 |
+ dev-python/xlwt[${PYTHON_USEDEP}] |
82 |
+ ) |
83 |
+ gtk3? ( |
84 |
+ >=dev-python/pygobject-3.40.1-r1:3[cairo?,${PYTHON_USEDEP}] |
85 |
+ x11-libs/gtk+:3[introspection] |
86 |
+ ) |
87 |
+ latex? ( |
88 |
+ virtual/latex-base |
89 |
+ app-text/dvipng |
90 |
+ app-text/ghostscript-gpl |
91 |
+ app-text/poppler[utils] |
92 |
+ dev-texlive/texlive-fontsrecommended |
93 |
+ dev-texlive/texlive-latexextra |
94 |
+ dev-texlive/texlive-luatex |
95 |
+ dev-texlive/texlive-xetex |
96 |
+ ) |
97 |
+ qt5? ( |
98 |
+ dev-python/PyQt5[gui,widgets,${PYTHON_USEDEP}] |
99 |
+ ) |
100 |
+ webagg? ( |
101 |
+ >=www-servers/tornado-6.0.4[${PYTHON_USEDEP}] |
102 |
+ ) |
103 |
+ wxwidgets? ( |
104 |
+ dev-python/wxpython:*[${PYTHON_USEDEP}] |
105 |
+ ) |
106 |
+" |
107 |
+ |
108 |
+BDEPEND=" |
109 |
+ ${RDEPEND} |
110 |
+ dev-python/setuptools_scm[${PYTHON_USEDEP}] |
111 |
+ dev-python/setuptools_scm_git_archive[${PYTHON_USEDEP}] |
112 |
+ virtual/pkgconfig |
113 |
+ doc? ( |
114 |
+ >=app-text/dvipng-1.15-r1 |
115 |
+ >=dev-python/colorspacious-1.1.2[${PYTHON_USEDEP}] |
116 |
+ >=dev-python/ipython-1.18.2[${PYTHON_USEDEP}] |
117 |
+ >=dev-python/numpydoc-0.9.2[${PYTHON_USEDEP}] |
118 |
+ >=dev-python/scipy-1.4.1[${PYTHON_USEDEP}] |
119 |
+ >=dev-python/sphinx-1.3.1[${PYTHON_USEDEP}] |
120 |
+ >=dev-python/sphinx-gallery-0.3.1-r1[${PYTHON_USEDEP}] |
121 |
+ >=dev-python/xlwt-1.3.0-r1[${PYTHON_USEDEP}] |
122 |
+ virtual/latex-base |
123 |
+ dev-texlive/texlive-latexextra |
124 |
+ dev-texlive/texlive-fontsrecommended |
125 |
+ dev-texlive/texlive-latexrecommended |
126 |
+ dev-texlive/texlive-luatex |
127 |
+ dev-texlive/texlive-xetex |
128 |
+ >=media-gfx/graphviz-2.42.3[cairo] |
129 |
+ ) |
130 |
+ test? ( |
131 |
+ dev-python/mock[${PYTHON_USEDEP}] |
132 |
+ dev-python/psutil[${PYTHON_USEDEP}] |
133 |
+ dev-python/pytest-xdist[${PYTHON_USEDEP}] |
134 |
+ >=dev-python/pygobject-3.40.1-r1:3[cairo?,${PYTHON_USEDEP}] |
135 |
+ >=www-servers/tornado-6.0.4[${PYTHON_USEDEP}] |
136 |
+ x11-libs/gtk+:3[introspection] |
137 |
+ ) |
138 |
+" |
139 |
+ |
140 |
+distutils_enable_tests pytest |
141 |
+ |
142 |
+use_setup() { |
143 |
+ local uword="${2:-${1}}" |
144 |
+ if use "${1}"; then |
145 |
+ echo "${uword} = True" |
146 |
+ echo "${uword}agg = True" |
147 |
+ else |
148 |
+ echo "${uword} = False" |
149 |
+ echo "${uword}agg = False" |
150 |
+ fi |
151 |
+} |
152 |
+ |
153 |
+python_prepare_all() { |
154 |
+# Generates test failures, but fedora does it |
155 |
+# local PATCHES=( |
156 |
+# "${FILESDIR}"/${P}-unbundle-pycxx.patch |
157 |
+# "${FILESDIR}"/${P}-unbundle-agg.patch |
158 |
+# ) |
159 |
+# rm -r agg24 CXX || die |
160 |
+# rm -r agg24 || die |
161 |
+ |
162 |
+# cat > lib/${PN}/externals/six.py <<-EOF |
163 |
+# from __future__ import absolute_import |
164 |
+# from six import * |
165 |
+# EOF |
166 |
+ |
167 |
+ local PATCHES=( |
168 |
+ "${FILESDIR}"/matplotlib-3.3.3-disable-lto.patch |
169 |
+ "${FILESDIR}"/matplotlib-3.5.2-test.patch |
170 |
+ ) |
171 |
+ |
172 |
+ sed \ |
173 |
+ -e 's/matplotlib.pyparsing_py[23]/pyparsing/g' \ |
174 |
+ -i lib/matplotlib/{mathtext,fontconfig_pattern}.py \ |
175 |
+ || die "sed pyparsing failed" |
176 |
+ |
177 |
+ hprefixify setupext.py |
178 |
+ |
179 |
+ rm -rf libqhull || die |
180 |
+ |
181 |
+ distutils-r1_python_prepare_all |
182 |
+} |
183 |
+ |
184 |
+python_configure_all() { |
185 |
+ append-flags -fno-strict-aliasing |
186 |
+ append-cppflags -DNDEBUG # or get old trying to do triangulation |
187 |
+ tc-export PKG_CONFIG |
188 |
+ |
189 |
+ unset DISPLAY # bug #278524 |
190 |
+ export XDG_RUNTIME_DIR="${T}/runtime-dir" |
191 |
+ mkdir "${XDG_RUNTIME_DIR}" || die |
192 |
+ chmod 0700 "${XDG_RUNTIME_DIR}" || die |
193 |
+} |
194 |
+ |
195 |
+python_configure() { |
196 |
+ mkdir -p "${BUILD_DIR}" || die |
197 |
+ |
198 |
+ # create setup.cfg (see setup.cfg.template for any changes). |
199 |
+ |
200 |
+ # common switches. |
201 |
+ cat > "${BUILD_DIR}"/setup.cfg <<- EOF || die |
202 |
+ [directories] |
203 |
+ basedirlist = ${EPREFIX}/usr |
204 |
+ [provide_packages] |
205 |
+ pytz = False |
206 |
+ dateutil = False |
207 |
+ [libs] |
208 |
+ system_freetype = True |
209 |
+ system_qhull = True |
210 |
+ [packages] |
211 |
+ tests = True |
212 |
+ [gui_support] |
213 |
+ agg = True |
214 |
+ gtk = False |
215 |
+ gtkagg = False |
216 |
+ macosx = False |
217 |
+ pyside = False |
218 |
+ pysideagg = False |
219 |
+ qt4 = False |
220 |
+ qt4agg = False |
221 |
+ $(use_setup cairo) |
222 |
+ $(use_setup gtk3) |
223 |
+ $(use_setup qt5) |
224 |
+ $(use_setup tk) |
225 |
+ $(use_setup wxwidgets wx) |
226 |
+ EOF |
227 |
+ |
228 |
+ if use gtk3 && use cairo; then |
229 |
+ echo "gtk3cairo = True" >> "${BUILD_DIR}"/setup.cfg || die |
230 |
+ else |
231 |
+ echo "gtk3cairo = False" >> "${BUILD_DIR}"/setup.cfg || die |
232 |
+ fi |
233 |
+} |
234 |
+ |
235 |
+wrap_setup() { |
236 |
+ local MAKEOPTS=-j1 |
237 |
+ local -x MPLSETUPCFG="${BUILD_DIR}"/setup.cfg |
238 |
+ "$@" |
239 |
+} |
240 |
+ |
241 |
+python_compile() { |
242 |
+ wrap_setup distutils-r1_python_compile |
243 |
+ find "${BUILD_DIR}" -name '*.pth' -delete || die |
244 |
+} |
245 |
+ |
246 |
+python_compile_all() { |
247 |
+ if use doc; then |
248 |
+ cd doc || die |
249 |
+ |
250 |
+ VARTEXFONTS="${T}"/fonts \ |
251 |
+ emake SPHINXOPTS= O=-Dplot_formats=png:100 html |
252 |
+ fi |
253 |
+} |
254 |
+ |
255 |
+src_test() { |
256 |
+ mkdir build || die |
257 |
+ ln -s "${WORKDIR}/freetype-${FT_PV}" build/ || die |
258 |
+ virtx distutils-r1_src_test |
259 |
+} |
260 |
+ |
261 |
+python_test() { |
262 |
+ local EPYTEST_DESELECT=( |
263 |
+ # broken by -Wdefault |
264 |
+ "tests/test_rcparams.py::test_validator_invalid[validate_strlist-arg6-MatplotlibDeprecationWarning]" |
265 |
+ "tests/test_rcparams.py::test_validator_invalid[validate_strlist-arg7-MatplotlibDeprecationWarning]" |
266 |
+ tests/test_testing.py::test_warn_to_fail |
267 |
+ ) |
268 |
+ |
269 |
+ # we need to rebuild mpl against bundled freetype, otherwise |
270 |
+ # over 1000 tests will fail because of mismatched font rendering |
271 |
+ grep -v system_freetype "${BUILD_DIR}"/setup.cfg \ |
272 |
+ > "${BUILD_DIR}"/test-setup.cfg || die |
273 |
+ local -x MPLSETUPCFG="${BUILD_DIR}"/test-setup.cfg |
274 |
+ |
275 |
+ esetup.py build -j1 --build-lib="${BUILD_DIR}"/test-lib |
276 |
+ local -x PYTHONPATH=${BUILD_DIR}/test-lib:${PYTHONPATH} |
277 |
+ |
278 |
+ # speed tests up |
279 |
+ local -x PYTEST_DISABLE_PLUGIN_AUTOLOAD=1 |
280 |
+ nonfatal epytest --pyargs matplotlib -m "not network" \ |
281 |
+ -p xdist.plugin -n "$(makeopts_jobs)" || die |
282 |
+} |
283 |
+ |
284 |
+python_install_all() { |
285 |
+ use doc && local HTML_DOCS=( doc/build/html/. ) |
286 |
+ |
287 |
+ distutils-r1_python_install_all |
288 |
+ |
289 |
+ if use examples; then |
290 |
+ dodoc -r examples |
291 |
+ docompress -x /usr/share/doc/${PF}/examples |
292 |
+ fi |
293 |
+} |