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-python2/files/, dev-python/matplotlib-python2/
Date: Tue, 28 Jan 2020 20:40:42
Message-Id: 1580244020.5ce6e9f145b6967e96b21a3790699e035be60046.mgorny@gentoo
1 commit: 5ce6e9f145b6967e96b21a3790699e035be60046
2 Author: Michał Górny <mgorny <AT> gentoo <DOT> org>
3 AuthorDate: Tue Jan 28 19:05:23 2020 +0000
4 Commit: Michał Górny <mgorny <AT> gentoo <DOT> org>
5 CommitDate: Tue Jan 28 20:40:20 2020 +0000
6 URL: https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=5ce6e9f1
7
8 dev-python/matplotlib-python2: Split from matplotlib
9
10 Signed-off-by: Michał Górny <mgorny <AT> gentoo.org>
11
12 dev-python/matplotlib-python2/Manifest | 1 +
13 .../files/matplotlib-2.2.4-doc-fix.patch | 18 ++
14 .../matplotlib-2.2.4-no-jqueryui-download.patch | 18 ++
15 .../matplotlib-python2-2.2.4.ebuild | 216 +++++++++++++++++++++
16 dev-python/matplotlib-python2/metadata.xml | 27 +++
17 5 files changed, 280 insertions(+)
18
19 diff --git a/dev-python/matplotlib-python2/Manifest b/dev-python/matplotlib-python2/Manifest
20 new file mode 100644
21 index 00000000000..0f0b9048ffb
22 --- /dev/null
23 +++ b/dev-python/matplotlib-python2/Manifest
24 @@ -0,0 +1 @@
25 +DIST matplotlib-2.2.4.tar.gz 36974286 BLAKE2B 9c4c69163a23ff02107ee155f72e142dcf31ba965f6a20f468b96f3f4b70b95ff6caade6b14bcbacd5b231848d2000ce6af9f113feefb41d6e186725349490d3 SHA512 968f5731b8a9a2c5575403c60d5b0a98a452b33094e520be44f4d901f892d082babc8fc1d73c519e1ff2baf756f3cb7652f4b796e166d66dfda31f7e50c58139
26
27 diff --git a/dev-python/matplotlib-python2/files/matplotlib-2.2.4-doc-fix.patch b/dev-python/matplotlib-python2/files/matplotlib-2.2.4-doc-fix.patch
28 new file mode 100644
29 index 00000000000..b6a01b097a6
30 --- /dev/null
31 +++ b/dev-python/matplotlib-python2/files/matplotlib-2.2.4-doc-fix.patch
32 @@ -0,0 +1,18 @@
33 +diff --git a/doc/conf.py b/doc/conf.py
34 +index 017ce210e..5a397082b 100644
35 +--- a/doc/conf.py
36 ++++ b/doc/conf.py
37 +@@ -170,10 +170,10 @@ source_encoding = "utf-8"
38 + master_doc = 'contents'
39 +
40 + # General substitutions.
41 +-from matplotlib.compat.subprocess import check_output
42 +-SHA = check_output(['git', 'describe', '--dirty']).decode('utf-8').strip()
43 ++#from matplotlib.compat.subprocess import check_output
44 ++#SHA = check_output(['git', 'describe', '--dirty']).decode('utf-8').strip()
45 +
46 +-html_context = {'sha': SHA}
47 ++#html_context = {'sha': SHA}
48 +
49 + project = 'Matplotlib'
50 + copyright = ('2002 - 2012 John Hunter, Darren Dale, Eric Firing, '
51
52 diff --git a/dev-python/matplotlib-python2/files/matplotlib-2.2.4-no-jqueryui-download.patch b/dev-python/matplotlib-python2/files/matplotlib-2.2.4-no-jqueryui-download.patch
53 new file mode 100644
54 index 00000000000..9d13adb8ab5
55 --- /dev/null
56 +++ b/dev-python/matplotlib-python2/files/matplotlib-2.2.4-no-jqueryui-download.patch
57 @@ -0,0 +1,18 @@
58 +diff --git a/setup.py b/setup.py
59 +index 41037e95d..6a438fa99 100644
60 +--- a/setup.py
61 ++++ b/setup.py
62 +@@ -178,9 +178,10 @@ class sdist_with_jquery(_orgin_sdist):
63 + class install_lib_with_jquery(InstallLibCommand):
64 + def run(self):
65 + InstallLibCommand.run(self)
66 +- _download_jquery_to(
67 +- os.path.join(self.install_dir, "matplotlib/backends/web_backend/"))
68 +-
69 ++ # Avoid downloading jquery ui during emerge: we already have it in
70 ++ # pypi's tarball. use this!
71 ++ name = "matplotlib/backends/web_backend/jquery-ui-1.12.1"
72 ++ os.rename(os.path.join('lib', name), os.path.join(self.install_dir, name))
73 +
74 + class develop_with_jquery(DevelopCommand):
75 + def run(self):
76
77 diff --git a/dev-python/matplotlib-python2/matplotlib-python2-2.2.4.ebuild b/dev-python/matplotlib-python2/matplotlib-python2-2.2.4.ebuild
78 new file mode 100644
79 index 00000000000..3f9831ca74f
80 --- /dev/null
81 +++ b/dev-python/matplotlib-python2/matplotlib-python2-2.2.4.ebuild
82 @@ -0,0 +1,216 @@
83 +# Copyright 1999-2020 Gentoo Authors
84 +# Distributed under the terms of the GNU General Public License v2
85 +
86 +EAPI=6
87 +
88 +PYTHON_COMPAT=( python2_7 )
89 +PYTHON_REQ_USE='tk?,threads(+)'
90 +
91 +inherit distutils-r1 flag-o-matic virtualx toolchain-funcs prefix
92 +
93 +MY_PN=${PN/-python2}
94 +MY_P=${MY_PN}-${PV}
95 +
96 +DESCRIPTION="Pure python plotting library with matlab like syntax (py2 version)"
97 +HOMEPAGE="https://matplotlib.org/"
98 +SRC_URI="mirror://pypi/${MY_PN:0:1}/${MY_PN}/${MY_P}.tar.gz"
99 +S=${WORKDIR}/${MY_P}
100 +
101 +SLOT="0"
102 +# Main license: matplotlib
103 +# Some modules: BSD
104 +# matplotlib/backends/qt4_editor: MIT
105 +# Fonts: BitstreamVera, OFL-1.1
106 +LICENSE="BitstreamVera BSD matplotlib MIT OFL-1.1"
107 +KEYWORDS="~amd64 ~arm ~arm64 ~ppc ~ppc64 ~x86"
108 +IUSE="cairo excel gtk2 gtk3 latex qt5 test tk wxwidgets"
109 +RESTRICT="!test? ( test )"
110 +
111 +REQUIRED_USE="
112 + test? (
113 + cairo latex qt5 tk wxwidgets
114 + || ( gtk2 gtk3 )
115 + )"
116 +
117 +# #456704 -- a lot of py2-only deps
118 +COMMON_DEPEND="
119 + dev-python/functools32[${PYTHON_USEDEP}]
120 + dev-python/subprocess32[${PYTHON_USEDEP}]
121 + dev-python/backports-functools-lru-cache[${PYTHON_USEDEP}]
122 + dev-python/cycler[${PYTHON_USEDEP}]
123 + || (
124 + >=dev-python/numpy-python2-1.7.1[${PYTHON_USEDEP}]
125 + >=dev-python/numpy-1.7.1[${PYTHON_USEDEP}]
126 + )
127 + dev-python/python-dateutil:0[${PYTHON_USEDEP}]
128 + dev-python/pytz[${PYTHON_USEDEP}]
129 + >=dev-python/six-1.10[${PYTHON_USEDEP}]
130 + media-fonts/stix-fonts
131 + media-libs/freetype:2
132 + media-libs/libpng:0
133 + >=media-libs/qhull-2013
134 + >=dev-python/kiwisolver-1.0.0[${PYTHON_USEDEP}]
135 + cairo? ( dev-python/cairocffi[${PYTHON_USEDEP}] )
136 + gtk2? (
137 + dev-libs/glib:2=
138 + x11-libs/gdk-pixbuf
139 + x11-libs/gtk+:2
140 + dev-python/pygtk[${PYTHON_USEDEP}] )
141 + wxwidgets? ( >=dev-python/wxpython-2.8:*[${PYTHON_USEDEP}] )"
142 +
143 +# internal copy of pycxx highly patched
144 +# dev-python/pycxx
145 +
146 +DEPEND="${COMMON_DEPEND}
147 + dev-python/versioneer[${PYTHON_USEDEP}]
148 + dev-python/setuptools[${PYTHON_USEDEP}]
149 + virtual/pkgconfig
150 + test? (
151 + dev-python/mock[${PYTHON_USEDEP}]
152 + >=dev-python/nose-0.11.1[${PYTHON_USEDEP}]
153 + )"
154 +
155 +RDEPEND="${COMMON_DEPEND}
156 + !<dev-python/matplotlib-3
157 + >=dev-python/pyparsing-1.5.6[${PYTHON_USEDEP}]
158 + excel? ( dev-python/xlwt[${PYTHON_USEDEP}] )
159 + gtk3? (
160 + dev-python/pygobject:3[${PYTHON_USEDEP}]
161 + x11-libs/gtk+:3[introspection] )
162 + latex? (
163 + virtual/latex-base
164 + app-text/ghostscript-gpl
165 + app-text/dvipng
166 + app-text/poppler[utils]
167 + dev-texlive/texlive-fontsrecommended
168 + dev-texlive/texlive-latexextra
169 + dev-texlive/texlive-xetex
170 + )
171 + qt5? ( dev-python/PyQt5[gui,widgets,${PYTHON_USEDEP}] )"
172 +
173 +# A few C++ source files are written to srcdir.
174 +# Other than that, the ebuild shall be fit for out-of-source build.
175 +DISTUTILS_IN_SOURCE_BUILD=1
176 +
177 +pkg_setup() {
178 + unset DISPLAY # bug #278524
179 +}
180 +
181 +use_setup() {
182 + local uword="${2:-${1}}"
183 + if use ${1}; then
184 + echo "${uword} = True"
185 + echo "${uword}agg = True"
186 + else
187 + echo "${uword} = False"
188 + echo "${uword}agg = False"
189 + fi
190 +}
191 +
192 +python_prepare_all() {
193 +# Generates test failures, but fedora does it
194 +# local PATCHES=(
195 +# "${FILESDIR}"/${P}-unbundle-pycxx.patch
196 +# "${FILESDIR}"/${P}-unbundle-agg.patch
197 +# )
198 +# rm -r agg24 CXX || die
199 +# rm -r agg24 || die
200 +
201 +# cat > lib/${PN}/externals/six.py <<-EOF
202 +# from __future__ import absolute_import
203 +# from six import *
204 +# EOF
205 +
206 + local PATCHES=(
207 + "${FILESDIR}"/${MY_PN}-2.2.4-doc-fix.patch
208 + "${FILESDIR}"/${MY_PN}-2.2.4-no-jqueryui-download.patch
209 + )
210 +
211 + sed \
212 + -e 's/matplotlib.pyparsing_py[23]/pyparsing/g' \
213 + -i lib/matplotlib/{mathtext,fontconfig_pattern}.py \
214 + || die "sed pyparsing failed"
215 +
216 + hprefixify setupext.py
217 +
218 + export XDG_RUNTIME_DIR="${T}/runtime-dir"
219 + mkdir "${XDG_RUNTIME_DIR}" || die
220 + chmod 0700 "${XDG_RUNTIME_DIR}" || die
221 +
222 + distutils-r1_python_prepare_all
223 +}
224 +
225 +python_configure_all() {
226 + append-flags -fno-strict-aliasing
227 + append-cppflags -DNDEBUG # or get old trying to do triangulation
228 + tc-export PKG_CONFIG
229 +}
230 +
231 +python_configure() {
232 + mkdir -p "${BUILD_DIR}" || die
233 +
234 + # create setup.cfg (see setup.cfg.template for any changes).
235 +
236 + # common switches.
237 + cat > "${BUILD_DIR}"/setup.cfg <<- EOF || die
238 + [directories]
239 + basedirlist = ${EPREFIX}/usr
240 + [provide_packages]
241 + pytz = False
242 + dateutil = False
243 + [packages]
244 + tests = $(usex test True False)
245 + [gui_support]
246 + agg = True
247 + pyside = False
248 + pysideagg = False
249 + qt4 = False
250 + qt4agg = False
251 + $(use_setup cairo)
252 + $(use_setup gtk3)
253 + $(use_setup qt5)
254 + $(use_setup tk)
255 + EOF
256 +
257 + if use gtk3 && use cairo; then
258 + echo "gtk3cairo = True" >> "${BUILD_DIR}"/setup.cfg || die
259 + else
260 + echo "gtk3cairo = False" >> "${BUILD_DIR}"/setup.cfg || die
261 + fi
262 +
263 + cat >> "${BUILD_DIR}"/setup.cfg <<-EOF || die
264 + $(use_setup gtk2 gtk)
265 + $(use_setup wxwidgets wx)
266 + EOF
267 +}
268 +
269 +wrap_setup() {
270 + local MAKEOPTS=-j1
271 + local -x MPLSETUPCFG="${BUILD_DIR}"/setup.cfg
272 + unset DISPLAY
273 + "$@"
274 +}
275 +
276 +python_compile() {
277 + wrap_setup distutils-r1_python_compile --build-lib="${BUILD_DIR}"/lib
278 +}
279 +
280 +python_test() {
281 + wrap_setup distutils_install_for_testing
282 +
283 + virtx "${EPYTHON}" -c "import sys, matplotlib as m; sys.exit(0 if m.test(verbosity=2) else 1)"
284 +}
285 +
286 +python_install() {
287 + wrap_setup distutils-r1_python_install
288 +
289 + # mpl_toolkits namespace
290 + python_moduleinto mpl_toolkits
291 + python_domodule lib/mpl_toolkits/__init__.py
292 +}
293 +
294 +python_install_all() {
295 + distutils-r1_python_install_all
296 +
297 + find "${D}" -name '*.pth' -delete || die
298 +}
299
300 diff --git a/dev-python/matplotlib-python2/metadata.xml b/dev-python/matplotlib-python2/metadata.xml
301 new file mode 100644
302 index 00000000000..d238bedf5ab
303 --- /dev/null
304 +++ b/dev-python/matplotlib-python2/metadata.xml
305 @@ -0,0 +1,27 @@
306 +<?xml version="1.0" encoding="UTF-8"?>
307 +<!DOCTYPE pkgmetadata SYSTEM "http://www.gentoo.org/dtd/metadata.dtd">
308 +<pkgmetadata>
309 + <maintainer type="project">
310 + <email>sci@g.o</email>
311 + <name>Gentoo Science Project</name>
312 + </maintainer>
313 + <maintainer type="project">
314 + <email>python@g.o</email>
315 + <name>Python</name>
316 + </maintainer>
317 + <longdescription lang="en">
318 + matplotlib is an interactive library for plotting and doing basic
319 + data analysis in python with a syntax similar to matlab. It provides a
320 + variety of backends and hard copy formats for almost ready
321 + publication plots.
322 + </longdescription>
323 + <use>
324 + <flag name="excel">Pull <pkg>dev-python/xlwt</pkg> for the exceltools toolkit</flag>
325 + <flag name="gtk2">Enable <pkg>x11-libs/gtk+</pkg>:2 support</flag>
326 + <flag name="gtk3">Enable <pkg>x11-libs/gtk+</pkg>:3 support</flag>
327 + </use>
328 + <upstream>
329 + <remote-id type="pypi">matplotlib</remote-id>
330 + <remote-id type="sourceforge">matplotlib</remote-id>
331 + </upstream>
332 +</pkgmetadata>