1 |
commit: 00d6926266e8a86f6d7f49f1e78a3a674d449a7c |
2 |
Author: Pacho Ramos <pacho <AT> gentoo <DOT> org> |
3 |
AuthorDate: Wed Dec 25 15:36:54 2019 +0000 |
4 |
Commit: Pacho Ramos <pacho <AT> gentoo <DOT> org> |
5 |
CommitDate: Wed Dec 25 16:57:12 2019 +0000 |
6 |
URL: https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=00d69262 |
7 |
|
8 |
dev-python/numpy-python2: Package supporting py2 for smoother transition |
9 |
|
10 |
As discussed in https://bugs.gentoo.org/703240 I will maintain a |
11 |
numpy-python2 package to allow easier transition of reverse deps allowing to |
12 |
still port them to python 3.8. |
13 |
|
14 |
The idea of this package is to drop it as soon as possible, as a |
15 |
consequence: |
16 |
- python2-only packages depending on this should have a bug opened and |
17 |
blocking bug #703754 to allow us to track upstream progress on python3 |
18 |
porting. As a consequence, if the package upstream is dead or not planning |
19 |
to port to python3 ever, it should be treecleaned instead of adding a |
20 |
dependency on this package. |
21 |
- python3 packages also needing python2 support. During a transition period, |
22 |
it's possible that we will need to temporally allow some packages (usually |
23 |
libraries) to support python2 until other reverse deps of that libs are |
24 |
handled. You should then open a bug report blocking bug #703756 to follow |
25 |
the progress on porting them completely to python3. As a consequence, if |
26 |
your package supports both, you must try to simply remove python2 support |
27 |
over depending on this package, while only adding a dep on numpy-python2 if |
28 |
it is really hard to handle all reverse deps immediately. In that case, a |
29 |
bug report need to be opened as explained. |
30 |
|
31 |
Closes: https://bugs.gentoo.org/703240 |
32 |
Package-Manager: Portage-2.3.82, Repoman-2.3.20 |
33 |
Signed-off-by: Pacho Ramos <pacho <AT> gentoo.org> |
34 |
|
35 |
dev-python/numpy-python2/Manifest | 4 + |
36 |
.../files/numpy-1.15.4-no-hardcode-blas.patch | 76 +++++++++ |
37 |
dev-python/numpy-python2/metadata.xml | 7 + |
38 |
.../numpy-python2/numpy-python2-1.16.5.ebuild | 169 +++++++++++++++++++++ |
39 |
4 files changed, 256 insertions(+) |
40 |
|
41 |
diff --git a/dev-python/numpy-python2/Manifest b/dev-python/numpy-python2/Manifest |
42 |
new file mode 100644 |
43 |
index 00000000000..5d698101579 |
44 |
--- /dev/null |
45 |
+++ b/dev-python/numpy-python2/Manifest |
46 |
@@ -0,0 +1,4 @@ |
47 |
+DIST numpy-1.16.5.zip 5138208 BLAKE2B f5511650e66939a6ce21cfad7874aecdeb6c07a70b32419a808956e42c7819d82bb364f1632da91b4d8a5237001c8ae3cbdcac10651fa0acca9558bdeafb5437 SHA512 6dd790ff57fdb7e7b0bddb47ea2b70b2667edefe632548ec68934e12a16af4a51bed9726e495c4993aad4c448dc4a204d0a087577d43dcfc9fa0164eb1d4b898 |
48 |
+DIST numpy-html-1.16.4.zip 12097069 BLAKE2B db1f897342fbc80a761fbaee7b0eee3761dbfa04ef6c46a137bb2392caaec8256580467ce06498cceeada2639151a1ec75dafab484d64cb897c008727d6d32a5 SHA512 c44c5e1e0cb22f9dd46fe9e302030292d85e567456178fee296746a414271634e906509fb6665ac63fbfebdd13c5383574f0aa47b4fbc639063da31addc3316a |
49 |
+DIST numpy-ref-1.16.4.pdf 5176571 BLAKE2B 9a875ebd1473b241d463d810a6d191581aef961158f2f82959671b554ace3ad482795e4f3e1cb7dd4632cff926c1e864c675a7624fb0f4e4f297948bf50f0564 SHA512 983ba0f34a70c011886bdbc9fd8f3f75a3a967ca29217acc76fa46e7da391296a5628c9a557ac76efb393271abfb8ee4f376d401c1cc1e5c30622e54b9325d09 |
50 |
+DIST numpy-user-1.16.4.pdf 596203 BLAKE2B da3ad1f0ec1c965d20656f73a970911cbb58efa73a5df89e2e6485e0dd763f483e35eea1395ac919bf35d496fb216cee954fc5d31edebc1796a24a2a7a2d12b9 SHA512 3083008547213bfa98ffa5cd8e2cea13f6947f42d83aef61502a2a852b0d5f27d727c76b42d281d7a2f4f76c78e88b12ee3d9b164b39fe1f0213ace7097357d6 |
51 |
|
52 |
diff --git a/dev-python/numpy-python2/files/numpy-1.15.4-no-hardcode-blas.patch b/dev-python/numpy-python2/files/numpy-1.15.4-no-hardcode-blas.patch |
53 |
new file mode 100644 |
54 |
index 00000000000..979b56bd6dc |
55 |
--- /dev/null |
56 |
+++ b/dev-python/numpy-python2/files/numpy-1.15.4-no-hardcode-blas.patch |
57 |
@@ -0,0 +1,76 @@ |
58 |
+diff --git a/numpy/distutils/system_info.py b/numpy/distutils/system_info.py |
59 |
+index 65d7de316..a85640d30 100644 |
60 |
+--- a/numpy/distutils/system_info.py |
61 |
++++ b/numpy/distutils/system_info.py |
62 |
+@@ -364,29 +364,7 @@ def get_info(name, notfound_action=0): |
63 |
+ 1 - display warning message |
64 |
+ 2 - raise error |
65 |
+ """ |
66 |
+- cl = {'atlas': atlas_info, # use lapack_opt or blas_opt instead |
67 |
+- 'atlas_threads': atlas_threads_info, # ditto |
68 |
+- 'atlas_blas': atlas_blas_info, |
69 |
+- 'atlas_blas_threads': atlas_blas_threads_info, |
70 |
+- 'lapack_atlas': lapack_atlas_info, # use lapack_opt instead |
71 |
+- 'lapack_atlas_threads': lapack_atlas_threads_info, # ditto |
72 |
+- 'atlas_3_10': atlas_3_10_info, # use lapack_opt or blas_opt instead |
73 |
+- 'atlas_3_10_threads': atlas_3_10_threads_info, # ditto |
74 |
+- 'atlas_3_10_blas': atlas_3_10_blas_info, |
75 |
+- 'atlas_3_10_blas_threads': atlas_3_10_blas_threads_info, |
76 |
+- 'lapack_atlas_3_10': lapack_atlas_3_10_info, # use lapack_opt instead |
77 |
+- 'lapack_atlas_3_10_threads': lapack_atlas_3_10_threads_info, # ditto |
78 |
+- 'mkl': mkl_info, |
79 |
+- # openblas which may or may not have embedded lapack |
80 |
+- 'openblas': openblas_info, # use blas_opt instead |
81 |
+- # openblas with embedded lapack |
82 |
+- 'openblas_lapack': openblas_lapack_info, # use blas_opt instead |
83 |
+- 'openblas_clapack': openblas_clapack_info, # use blas_opt instead |
84 |
+- 'blis': blis_info, # use blas_opt instead |
85 |
+- 'lapack_mkl': lapack_mkl_info, # use lapack_opt instead |
86 |
+- 'blas_mkl': blas_mkl_info, # use blas_opt instead |
87 |
+- 'accelerate': accelerate_info, # use blas_opt instead |
88 |
+- 'x11': x11_info, |
89 |
++ cl = {'x11': x11_info, |
90 |
+ 'fft_opt': fft_opt_info, |
91 |
+ 'fftw': fftw_info, |
92 |
+ 'fftw2': fftw2_info, |
93 |
+@@ -731,10 +709,7 @@ class system_info(object): |
94 |
+ return [b for b in [a.strip() for a in libs.split(',')] if b] |
95 |
+ |
96 |
+ def get_libraries(self, key='libraries'): |
97 |
+- if hasattr(self, '_lib_names'): |
98 |
+- return self.get_libs(key, default=self._lib_names) |
99 |
+- else: |
100 |
+- return self.get_libs(key, '') |
101 |
++ return self.get_libs(key, '') |
102 |
+ |
103 |
+ def library_extensions(self): |
104 |
+ c = customized_ccompiler() |
105 |
+@@ -1685,7 +1660,7 @@ class blas_info(system_info): |
106 |
+ lib = self.has_cblas(info) |
107 |
+ if lib is not None: |
108 |
+ info['language'] = 'c' |
109 |
+- info['libraries'] = [lib] |
110 |
++ info['libraries'] = lib |
111 |
+ info['define_macros'] = [('HAVE_CBLAS', None)] |
112 |
+ self.set_info(**info) |
113 |
+ |
114 |
+@@ -1717,16 +1692,16 @@ class blas_info(system_info): |
115 |
+ # check for cblas lib, and if not present check for blas lib. |
116 |
+ try: |
117 |
+ c.link_executable(obj, os.path.join(tmpdir, "a.out"), |
118 |
+- libraries=["cblas"], |
119 |
++ libraries=info["libraries"], |
120 |
+ library_dirs=info['library_dirs'], |
121 |
+ extra_postargs=info.get('extra_link_args', [])) |
122 |
+- res = "cblas" |
123 |
++ res = info["libraries"] |
124 |
+ except distutils.ccompiler.LinkError: |
125 |
+ c.link_executable(obj, os.path.join(tmpdir, "a.out"), |
126 |
+ libraries=["blas"], |
127 |
+ library_dirs=info['library_dirs'], |
128 |
+ extra_postargs=info.get('extra_link_args', [])) |
129 |
+- res = "blas" |
130 |
++ res = ["blas"] |
131 |
+ except distutils.ccompiler.CompileError: |
132 |
+ res = None |
133 |
+ finally: |
134 |
|
135 |
diff --git a/dev-python/numpy-python2/metadata.xml b/dev-python/numpy-python2/metadata.xml |
136 |
new file mode 100644 |
137 |
index 00000000000..020b40648ee |
138 |
--- /dev/null |
139 |
+++ b/dev-python/numpy-python2/metadata.xml |
140 |
@@ -0,0 +1,7 @@ |
141 |
+<?xml version="1.0" encoding="UTF-8"?> |
142 |
+<!DOCTYPE pkgmetadata SYSTEM "http://www.gentoo.org/dtd/metadata.dtd"> |
143 |
+<pkgmetadata> |
144 |
+ <maintainer type="person"> |
145 |
+ <email>pacho@g.o</email> |
146 |
+ </maintainer> |
147 |
+</pkgmetadata> |
148 |
|
149 |
diff --git a/dev-python/numpy-python2/numpy-python2-1.16.5.ebuild b/dev-python/numpy-python2/numpy-python2-1.16.5.ebuild |
150 |
new file mode 100644 |
151 |
index 00000000000..caad08decf1 |
152 |
--- /dev/null |
153 |
+++ b/dev-python/numpy-python2/numpy-python2-1.16.5.ebuild |
154 |
@@ -0,0 +1,169 @@ |
155 |
+# Copyright 1999-2019 Gentoo Authors |
156 |
+# Distributed under the terms of the GNU General Public License v2 |
157 |
+ |
158 |
+EAPI="7" |
159 |
+ |
160 |
+PYTHON_COMPAT=( python2_7 ) |
161 |
+PYTHON_REQ_USE="threads(+)" |
162 |
+ |
163 |
+FORTRAN_NEEDED=lapack |
164 |
+ |
165 |
+inherit distutils-r1 flag-o-matic fortran-2 multiprocessing toolchain-funcs |
166 |
+ |
167 |
+MY_PN="numpy" |
168 |
+DOC_PV="1.16.4" |
169 |
+ |
170 |
+DESCRIPTION="Fast array and numerical python library" |
171 |
+HOMEPAGE="https://www.numpy.org" |
172 |
+SRC_URI=" |
173 |
+ mirror://pypi/${MY_PN:0:1}/${MY_PN}/${MY_PN}-${PV}.zip |
174 |
+ doc? ( |
175 |
+ https://numpy.org/doc/$(ver_cut 1-2 ${DOC_PV})/numpy-html.zip -> numpy-html-${DOC_PV}.zip |
176 |
+ https://numpy.org/doc/$(ver_cut 1-2 ${DOC_PV})/numpy-ref.pdf -> numpy-ref-${DOC_PV}.pdf |
177 |
+ https://numpy.org/doc/$(ver_cut 1-2 ${DOC_PV})/numpy-user.pdf -> numpy-user-${DOC_PV}.pdf |
178 |
+ )" |
179 |
+LICENSE="BSD" |
180 |
+SLOT="0" |
181 |
+KEYWORDS="~alpha ~amd64 ~arm ~arm64 ~hppa ~ia64 ~mips ~ppc ~ppc64 ~s390 ~sh ~sparc ~x86 ~amd64-linux ~x86-linux ~ppc-macos ~x64-macos ~x86-macos ~sparc-solaris ~x64-solaris ~x86-solaris" |
182 |
+IUSE="doc lapack test" |
183 |
+RESTRICT="!test? ( test )" |
184 |
+ |
185 |
+RDEPEND=" |
186 |
+ !<dev-python/numpy-1.17 |
187 |
+ lapack? ( |
188 |
+ virtual/cblas |
189 |
+ virtual/lapack |
190 |
+ ) |
191 |
+" |
192 |
+DEPEND="${RDEPEND}" |
193 |
+ |
194 |
+BDEPEND=" |
195 |
+ app-arch/unzip |
196 |
+ dev-python/setuptools[${PYTHON_USEDEP}] |
197 |
+ lapack? ( virtual/pkgconfig ) |
198 |
+ test? ( |
199 |
+ dev-python/pytest[${PYTHON_USEDEP}] |
200 |
+ ) |
201 |
+" |
202 |
+ |
203 |
+S="${WORKDIR}/${MY_PN}-${PV}" |
204 |
+ |
205 |
+PATCHES=( |
206 |
+ "${FILESDIR}"/${MY_PN}-1.15.4-no-hardcode-blas.patch |
207 |
+) |
208 |
+ |
209 |
+src_unpack() { |
210 |
+ default |
211 |
+ if use doc; then |
212 |
+ unzip -qo "${DISTDIR}"/numpy-html-${DOC_PV}.zip -d html || die |
213 |
+ fi |
214 |
+} |
215 |
+ |
216 |
+pc_incdir() { |
217 |
+ $(tc-getPKG_CONFIG) --cflags-only-I $@ | \ |
218 |
+ sed -e 's/^-I//' -e 's/[ ]*-I/:/g' -e 's/[ ]*$//' -e 's|^:||' |
219 |
+} |
220 |
+ |
221 |
+pc_libdir() { |
222 |
+ $(tc-getPKG_CONFIG) --libs-only-L $@ | \ |
223 |
+ sed -e 's/^-L//' -e 's/[ ]*-L/:/g' -e 's/[ ]*$//' -e 's|^:||' |
224 |
+} |
225 |
+ |
226 |
+pc_libs() { |
227 |
+ $(tc-getPKG_CONFIG) --libs-only-l $@ | \ |
228 |
+ sed -e 's/[ ]-l*\(pthread\|m\)\([ ]\|$\)//g' \ |
229 |
+ -e 's/^-l//' -e 's/[ ]*-l/,/g' -e 's/[ ]*$//' \ |
230 |
+ | tr ',' '\n' | sort -u | tr '\n' ',' | sed -e 's|,$||' |
231 |
+} |
232 |
+ |
233 |
+python_prepare_all() { |
234 |
+ if use lapack; then |
235 |
+ append-ldflags "$($(tc-getPKG_CONFIG) --libs-only-other cblas lapack)" |
236 |
+ local incdir="${EPREFIX}"/usr/include |
237 |
+ local libdir="${EPREFIX}"/usr/$(get_libdir) |
238 |
+ cat >> site.cfg <<-EOF || die |
239 |
+ [blas] |
240 |
+ include_dirs = $(pc_incdir cblas):${incdir} |
241 |
+ library_dirs = $(pc_libdir cblas blas):${libdir} |
242 |
+ blas_libs = $(pc_libs cblas blas) |
243 |
+ [lapack] |
244 |
+ library_dirs = $(pc_libdir lapack):${libdir} |
245 |
+ lapack_libs = $(pc_libs lapack) |
246 |
+ EOF |
247 |
+ else |
248 |
+ export {ATLAS,PTATLAS,BLAS,LAPACK,MKL}=None |
249 |
+ fi |
250 |
+ |
251 |
+ export CC="$(tc-getCC) ${CFLAGS}" |
252 |
+ |
253 |
+ append-flags -fno-strict-aliasing |
254 |
+ |
255 |
+ # See progress in http://projects.scipy.org/scipy/numpy/ticket/573 |
256 |
+ # with the subtle difference that we don't want to break Darwin where |
257 |
+ # -shared is not a valid linker argument |
258 |
+ if [[ ${CHOST} != *-darwin* ]]; then |
259 |
+ append-ldflags -shared |
260 |
+ fi |
261 |
+ |
262 |
+ # only one fortran to link with: |
263 |
+ # linking with cblas and lapack library will force |
264 |
+ # autodetecting and linking to all available fortran compilers |
265 |
+ append-fflags -fPIC |
266 |
+ if use lapack; then |
267 |
+ NUMPY_FCONFIG="config_fc --noopt --noarch" |
268 |
+ # workaround bug 335908 |
269 |
+ [[ $(tc-getFC) == *gfortran* ]] && NUMPY_FCONFIG+=" --fcompiler=gnu95" |
270 |
+ fi |
271 |
+ |
272 |
+ # don't version f2py, we will handle it. |
273 |
+ sed -i -e '/f2py_exe/s: + os\.path.*$::' numpy/f2py/setup.py || die |
274 |
+ |
275 |
+ # disable fuzzed tests |
276 |
+ find numpy/*/tests -name '*.py' -exec sed -i \ |
277 |
+ -e 's:def \(.*_fuzz\):def _\1:' {} + || die |
278 |
+ # very memory- and disk-hungry |
279 |
+ sed -i -e 's:test_large_zip:_&:' numpy/lib/tests/test_io.py || die |
280 |
+ |
281 |
+ distutils-r1_python_prepare_all |
282 |
+} |
283 |
+ |
284 |
+python_compile() { |
285 |
+ export MAKEOPTS=-j1 #660754 |
286 |
+ |
287 |
+ local python_makeopts_jobs="" |
288 |
+ python_is_python3 || python_makeopts_jobs="-j $(makeopts_jobs)" |
289 |
+ distutils-r1_python_compile \ |
290 |
+ ${python_makeopts_jobs} \ |
291 |
+ ${NUMPY_FCONFIG} |
292 |
+} |
293 |
+ |
294 |
+python_test() { |
295 |
+ distutils_install_for_testing --single-version-externally-managed \ |
296 |
+ --record "${TMPDIR}/record.txt" ${NUMPY_FCONFIG} |
297 |
+ |
298 |
+ cd "${TMPDIR}" || die |
299 |
+ |
300 |
+ "${EPYTHON}" -c " |
301 |
+import numpy, sys |
302 |
+r = numpy.test(label='full', verbose=3) |
303 |
+sys.exit(0 if r else 1)" || die "Tests fail with ${EPYTHON}" |
304 |
+} |
305 |
+ |
306 |
+python_install() { |
307 |
+ distutils-r1_python_install ${NUMPY_FCONFIG} |
308 |
+ python_optimize |
309 |
+} |
310 |
+ |
311 |
+python_install_all() { |
312 |
+ local DOCS=( THANKS.txt ) |
313 |
+ |
314 |
+ if use doc; then |
315 |
+ local HTML_DOCS=( "${WORKDIR}"/html/. ) |
316 |
+ DOCS+=( "${DISTDIR}"/${MY_PN}-{user,ref}-${DOC_PV}.pdf ) |
317 |
+ fi |
318 |
+ |
319 |
+ distutils-r1_python_install_all |
320 |
+ |
321 |
+ # Let latest version to provide f2py link |
322 |
+ rm "${ED}"/usr/bin/f2py || die |
323 |
+} |