Gentoo Archives: gentoo-commits

From: "罗百科" <patrick@g.o>
To: gentoo-commits@l.g.o
Subject: [gentoo-commits] repo/gentoo:master commit in: dev-python/numpy/files/, dev-python/numpy/
Date: Sun, 29 Dec 2019 16:11:08
Message-Id: 1577635855.817df86ab2fc967c40f1d2abe50a43bab24917df.patrick@gentoo
1 commit: 817df86ab2fc967c40f1d2abe50a43bab24917df
2 Author: Patrick Lauer <patrick <AT> gentoo <DOT> org>
3 AuthorDate: Sun Dec 29 15:44:26 2019 +0000
4 Commit: 罗百科 <patrick <AT> gentoo <DOT> org>
5 CommitDate: Sun Dec 29 16:10:55 2019 +0000
6 URL: https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=817df86a
7
8 dev-python/numpy: Fix build failures in 1.17.4
9
10 Fixes #700848
11
12 Package-Manager: Portage-2.3.84, Repoman-2.3.20
13 Signed-off-by: Patrick Lauer <patrick <AT> gentoo.org>
14
15 .../files/numpy-1.17.4-no-hardcode-blasv2.patch | 47 +++++++
16 dev-python/numpy/numpy-1.17.4-r1.ebuild | 154 +++++++++++++++++++++
17 2 files changed, 201 insertions(+)
18
19 diff --git a/dev-python/numpy/files/numpy-1.17.4-no-hardcode-blasv2.patch b/dev-python/numpy/files/numpy-1.17.4-no-hardcode-blasv2.patch
20 new file mode 100644
21 index 00000000000..850f70f4551
22 --- /dev/null
23 +++ b/dev-python/numpy/files/numpy-1.17.4-no-hardcode-blasv2.patch
24 @@ -0,0 +1,47 @@
25 +diff --git a/numpy/distutils/system_info.py b/numpy/distutils/system_info.py
26 +index ba2b1f46c..09db18e69 100644
27 +--- a/numpy/distutils/system_info.py
28 ++++ b/numpy/distutils/system_info.py
29 +@@ -374,28 +374,7 @@ def get_info(name, notfound_action=0):
30 + 1 - display warning message
31 + 2 - raise error
32 + """
33 +- cl = {'atlas': atlas_info, # use lapack_opt or blas_opt instead
34 +- 'atlas_threads': atlas_threads_info, # ditto
35 +- 'atlas_blas': atlas_blas_info,
36 +- 'atlas_blas_threads': atlas_blas_threads_info,
37 +- 'lapack_atlas': lapack_atlas_info, # use lapack_opt instead
38 +- 'lapack_atlas_threads': lapack_atlas_threads_info, # ditto
39 +- 'atlas_3_10': atlas_3_10_info, # use lapack_opt or blas_opt instead
40 +- 'atlas_3_10_threads': atlas_3_10_threads_info, # ditto
41 +- 'atlas_3_10_blas': atlas_3_10_blas_info,
42 +- 'atlas_3_10_blas_threads': atlas_3_10_blas_threads_info,
43 +- 'lapack_atlas_3_10': lapack_atlas_3_10_info, # use lapack_opt instead
44 +- 'lapack_atlas_3_10_threads': lapack_atlas_3_10_threads_info, # ditto
45 +- 'flame': flame_info, # use lapack_opt instead
46 +- 'mkl': mkl_info,
47 +- # openblas which may or may not have embedded lapack
48 +- 'openblas': openblas_info, # use blas_opt instead
49 +- # openblas with embedded lapack
50 +- 'openblas_lapack': openblas_lapack_info, # use blas_opt instead
51 +- 'openblas_clapack': openblas_clapack_info, # use blas_opt instead
52 +- 'blis': blis_info, # use blas_opt instead
53 +- 'lapack_mkl': lapack_mkl_info, # use lapack_opt instead
54 +- 'blas_mkl': blas_mkl_info, # use blas_opt instead
55 ++ cl = {'flame': flame_info, # use lapack_opt instead
56 + 'accelerate': accelerate_info, # use blas_opt instead
57 + 'x11': x11_info,
58 + 'fft_opt': fft_opt_info,
59 +@@ -796,10 +775,7 @@ class system_info(object):
60 + return [b for b in [a.strip() for a in libs.split(',')] if b]
61 +
62 + def get_libraries(self, key='libraries'):
63 +- if hasattr(self, '_lib_names'):
64 +- return self.get_libs(key, default=self._lib_names)
65 +- else:
66 +- return self.get_libs(key, '')
67 ++ return self.get_libs(key, '')
68 +
69 + def library_extensions(self):
70 + c = customized_ccompiler()
71 +
72
73 diff --git a/dev-python/numpy/numpy-1.17.4-r1.ebuild b/dev-python/numpy/numpy-1.17.4-r1.ebuild
74 new file mode 100644
75 index 00000000000..9219c98dfec
76 --- /dev/null
77 +++ b/dev-python/numpy/numpy-1.17.4-r1.ebuild
78 @@ -0,0 +1,154 @@
79 +# Copyright 1999-2019 Gentoo Authors
80 +# Distributed under the terms of the GNU General Public License v2
81 +
82 +EAPI=7
83 +
84 +PYTHON_COMPAT=( python3_{5,6,7,8} )
85 +PYTHON_REQ_USE="threads(+)"
86 +
87 +FORTRAN_NEEDED=lapack
88 +
89 +inherit distutils-r1 flag-o-matic fortran-2 multiprocessing toolchain-funcs
90 +
91 +DOC_PV="1.16.4"
92 +DESCRIPTION="Fast array and numerical python library"
93 +HOMEPAGE="https://www.numpy.org"
94 +SRC_URI="
95 + mirror://pypi/${PN:0:1}/${PN}/${P}.zip
96 + doc? (
97 + https://numpy.org/doc/$(ver_cut 1-2 ${DOC_PV})/numpy-html.zip -> numpy-html-${DOC_PV}.zip
98 + https://numpy.org/doc/$(ver_cut 1-2 ${DOC_PV})/numpy-ref.pdf -> numpy-ref-${DOC_PV}.pdf
99 + https://numpy.org/doc/$(ver_cut 1-2 ${DOC_PV})/numpy-user.pdf -> numpy-user-${DOC_PV}.pdf
100 + )"
101 +LICENSE="BSD"
102 +SLOT="0"
103 +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"
104 +IUSE="doc lapack test"
105 +RESTRICT="!test? ( test )"
106 +
107 +RDEPEND="
108 + lapack? (
109 + virtual/cblas
110 + virtual/lapack
111 + )"
112 +DEPEND="${RDEPEND}"
113 +BDEPEND="app-arch/unzip
114 + dev-python/setuptools[${PYTHON_USEDEP}]
115 + lapack? ( virtual/pkgconfig )
116 + test? (
117 + dev-python/pytest[${PYTHON_USEDEP}]
118 + )"
119 +
120 +PATCHES=(
121 + "${FILESDIR}"/${PN}-1.17.4-no-hardcode-blasv2.patch
122 +)
123 +
124 +src_unpack() {
125 + default
126 + if use doc; then
127 + unzip -qo "${DISTDIR}"/numpy-html-${DOC_PV}.zip -d html || die
128 + fi
129 +}
130 +
131 +pc_incdir() {
132 + $(tc-getPKG_CONFIG) --cflags-only-I $@ | \
133 + sed -e 's/^-I//' -e 's/[ ]*-I/:/g' -e 's/[ ]*$//' -e 's|^:||'
134 +}
135 +
136 +pc_libdir() {
137 + $(tc-getPKG_CONFIG) --libs-only-L $@ | \
138 + sed -e 's/^-L//' -e 's/[ ]*-L/:/g' -e 's/[ ]*$//' -e 's|^:||'
139 +}
140 +
141 +pc_libs() {
142 + $(tc-getPKG_CONFIG) --libs-only-l $@ | \
143 + sed -e 's/[ ]-l*\(pthread\|m\)\([ ]\|$\)//g' \
144 + -e 's/^-l//' -e 's/[ ]*-l/,/g' -e 's/[ ]*$//' \
145 + | tr ',' '\n' | sort -u | tr '\n' ',' | sed -e 's|,$||'
146 +}
147 +
148 +python_prepare_all() {
149 + if use lapack; then
150 + append-ldflags "$($(tc-getPKG_CONFIG) --libs-only-other cblas lapack)"
151 + local incdir="${EPREFIX}"/usr/include
152 + local libdir="${EPREFIX}"/usr/$(get_libdir)
153 + cat >> site.cfg <<-EOF || die
154 + [blas]
155 + blas_libs = $(pc_libs cblas blas)
156 + [lapack]
157 + lapack_libs = $(pc_libs lapack)
158 + EOF
159 + else
160 + export {ATLAS,PTATLAS,BLAS,LAPACK,MKL}=None
161 + fi
162 +
163 + export CC="$(tc-getCC) ${CFLAGS}"
164 +
165 + append-flags -fno-strict-aliasing
166 +
167 + # See progress in http://projects.scipy.org/scipy/numpy/ticket/573
168 + # with the subtle difference that we don't want to break Darwin where
169 + # -shared is not a valid linker argument
170 + if [[ ${CHOST} != *-darwin* ]]; then
171 + append-ldflags -shared
172 + fi
173 +
174 + # only one fortran to link with:
175 + # linking with cblas and lapack library will force
176 + # autodetecting and linking to all available fortran compilers
177 + append-fflags -fPIC
178 + if use lapack; then
179 + NUMPY_FCONFIG="config_fc --noopt --noarch"
180 + # workaround bug 335908
181 + [[ $(tc-getFC) == *gfortran* ]] && NUMPY_FCONFIG+=" --fcompiler=gnu95"
182 + fi
183 +
184 + # don't version f2py, we will handle it.
185 + sed -i -e '/f2py_exe/s: + os\.path.*$::' numpy/f2py/setup.py || die
186 +
187 + # disable fuzzed tests
188 + find numpy/*/tests -name '*.py' -exec sed -i \
189 + -e 's:def \(.*_fuzz\):def _\1:' {} + || die
190 + # very memory- and disk-hungry
191 + sed -i -e 's:test_large_zip:_&:' numpy/lib/tests/test_io.py || die
192 +
193 + distutils-r1_python_prepare_all
194 +}
195 +
196 +python_compile() {
197 + export MAKEOPTS=-j1 #660754
198 +
199 + local python_makeopts_jobs=""
200 + python_is_python3 || python_makeopts_jobs="-j $(makeopts_jobs)"
201 + distutils-r1_python_compile \
202 + ${python_makeopts_jobs} \
203 + ${NUMPY_FCONFIG}
204 +}
205 +
206 +python_test() {
207 + distutils_install_for_testing --single-version-externally-managed \
208 + --record "${TMPDIR}/record.txt" ${NUMPY_FCONFIG}
209 +
210 + cd "${TMPDIR}" || die
211 +
212 + "${EPYTHON}" -c "
213 +import numpy, sys
214 +r = numpy.test(label='full', verbose=3)
215 +sys.exit(0 if r else 1)" || die "Tests fail with ${EPYTHON}"
216 +}
217 +
218 +python_install() {
219 + distutils-r1_python_install ${NUMPY_FCONFIG}
220 + python_optimize
221 +}
222 +
223 +python_install_all() {
224 + local DOCS=( THANKS.txt )
225 +
226 + if use doc; then
227 + local HTML_DOCS=( "${WORKDIR}"/html/. )
228 + DOCS+=( "${DISTDIR}"/${PN}-{user,ref}-${DOC_PV}.pdf )
229 + fi
230 +
231 + distutils-r1_python_install_all
232 +}