Tue Apr 20 20:58:39 2021 UTC ()
math/py-numpy16: bring BLAS usage into line with math/py-numpy

This old version for PY27 now behaves just like the modern one
regarding usage of BLAS and actually CBLAS.


(thor)
diff -r1.5 -r1.6 pkgsrc/math/py-numpy16/Makefile
diff -r1.2 -r1.3 pkgsrc/math/py-numpy16/distinfo
diff -r1.2 -r1.3 pkgsrc/math/py-numpy16/patches/patch-numpy_distutils_system__info.py

cvs diff -r1.5 -r1.6 pkgsrc/math/py-numpy16/Makefile (expand / switch to unified diff)

--- pkgsrc/math/py-numpy16/Makefile 2020/10/12 21:52:03 1.5
+++ pkgsrc/math/py-numpy16/Makefile 2021/04/20 20:58:39 1.6
@@ -1,37 +1,38 @@ @@ -1,37 +1,38 @@
1# $NetBSD: Makefile,v 1.5 2020/10/12 21:52:03 bacon Exp $ 1# $NetBSD: Makefile,v 1.6 2021/04/20 20:58:39 thor Exp $
2 2
3DISTNAME= numpy-1.16.6 3DISTNAME= numpy-1.16.6
4PKGNAME= ${PYPKGPREFIX}-${DISTNAME} 4PKGNAME= ${PYPKGPREFIX}-${DISTNAME}
5PKGREVISION= 1 5PKGREVISION= 2
6CATEGORIES= math python 6CATEGORIES= math python
7MASTER_SITES= ${MASTER_SITE_PYPI:=n/numpy/} 7MASTER_SITES= ${MASTER_SITE_PYPI:=n/numpy/}
8EXTRACT_SUFX= .zip 8EXTRACT_SUFX= .zip
9 9
10MAINTAINER= pkgsrc-users@NetBSD.org 10MAINTAINER= pkgsrc-users@NetBSD.org
11HOMEPAGE= http://www.numpy.org/ 11HOMEPAGE= http://www.numpy.org/
12COMMENT= Array processing for numbers, strings, records, and objects 12COMMENT= Array processing for numbers, strings, records, and objects
13LICENSE= modified-bsd 13LICENSE= modified-bsd
14 14
15# While this builds with 3, the package only exists to accomodate 15# While this builds with 3, the package only exists to accomodate
16# things that require python2.7. 16# things that require python2.7.
17PYTHON_VERSIONS_ACCEPTED= 27 17PYTHON_VERSIONS_ACCEPTED= 27
18 18
19TEST_DEPENDS+= ${PYPKGPREFIX}-nose-[0-9]*:../../devel/py-nose 19TEST_DEPENDS+= ${PYPKGPREFIX}-nose-[0-9]*:../../devel/py-nose
20 20
21PYTHON_VERSIONED_DEPENDENCIES= test:test 21PYTHON_VERSIONED_DEPENDENCIES= test:test
22 22
23USE_LANGUAGES= c fortran 23USE_LANGUAGES= c fortran
24MAKE_ENV+= ATLAS=None 24
 25.include "../../math/py-numpy/Makefile.make_env"
25 26
26REPLACE_PYTHON+= *.py */*.py */*/*.py */*/*/*.py */*/*/*/*.py 27REPLACE_PYTHON+= *.py */*.py */*/*.py */*/*/*.py */*/*/*/*.py
27 28
28# XXX Avoid picking up other compilers when installed 29# XXX Avoid picking up other compilers when installed
29.include "../../mk/compiler.mk" 30.include "../../mk/compiler.mk"
30 31
31.if defined(PKGSRC_FORTRAN) && ${PKGSRC_FORTRAN} == "g95" 32.if defined(PKGSRC_FORTRAN) && ${PKGSRC_FORTRAN} == "g95"
32PYSETUPBUILDARGS+= --fcompiler=g95 33PYSETUPBUILDARGS+= --fcompiler=g95
33.elif defined(PKGSRC_FORTRAN) && ${PKGSRC_FORTRAN} == "gfortran" 34.elif defined(PKGSRC_FORTRAN) && ${PKGSRC_FORTRAN} == "gfortran"
34PYSETUPBUILDARGS+= --fcompiler=gnu95 35PYSETUPBUILDARGS+= --fcompiler=gnu95
35.elif !empty(PKGSRC_COMPILER:Mgcc) 36.elif !empty(PKGSRC_COMPILER:Mgcc)
36PYSETUPBUILDARGS+= --fcompiler=gnu 37PYSETUPBUILDARGS+= --fcompiler=gnu
37.endif 38.endif
@@ -49,19 +50,15 @@ MAKE_ENV.DragonFly+= LDVER=ld.bfd @@ -49,19 +50,15 @@ MAKE_ENV.DragonFly+= LDVER=ld.bfd
49 50
50post-install: 51post-install:
51 cd ${DESTDIR}${PREFIX}/bin && ${RM} f2py || ${TRUE} 52 cd ${DESTDIR}${PREFIX}/bin && ${RM} f2py || ${TRUE}
52 53
53do-test: 54do-test:
54 cd ${WRKDIR} && \ 55 cd ${WRKDIR} && \
55 ${RUN} PYTHONPATH=${DESTDIR}${PREFIX}/${PYSITELIB} ${PYTHONBIN} -c "import numpy; numpy.test()" 56 ${RUN} PYTHONPATH=${DESTDIR}${PREFIX}/${PYSITELIB} ${PYTHONBIN} -c "import numpy; numpy.test()"
56 57
57BUILDLINK_API_DEPENDS.py-cython+= ${PYPKGPREFIX}-cython>=0.29.2 58BUILDLINK_API_DEPENDS.py-cython+= ${PYPKGPREFIX}-cython>=0.29.2
58.include "../../devel/py-cython/buildlink3.mk" 59.include "../../devel/py-cython/buildlink3.mk"
59.include "../../lang/python/application.mk" 60.include "../../lang/python/application.mk"
60.include "../../lang/python/egg.mk" 61.include "../../lang/python/egg.mk"
61.include "../../lang/python/versioned_dependencies.mk" 62.include "../../lang/python/versioned_dependencies.mk"
62# Consider allowing mk/blas.buildlink3.mk to handle Accelerate.framework 63.include "../../math/cblas/buildlink3.mk"
63.if ${OPSYS} != "Darwin" 
64# blas and lapack are not needed; numpy will use Accelerate.framework 
65.include "../../mk/blas.buildlink3.mk" 
66.endif 
67.include "../../mk/bsd.pkg.mk" 64.include "../../mk/bsd.pkg.mk"

cvs diff -r1.2 -r1.3 pkgsrc/math/py-numpy16/distinfo (expand / switch to unified diff)

--- pkgsrc/math/py-numpy16/distinfo 2020/10/13 08:27:02 1.2
+++ pkgsrc/math/py-numpy16/distinfo 2021/04/20 20:58:39 1.3
@@ -1,11 +1,11 @@ @@ -1,11 +1,11 @@
1$NetBSD: distinfo,v 1.2 2020/10/13 08:27:02 leot Exp $ 1$NetBSD: distinfo,v 1.3 2021/04/20 20:58:39 thor Exp $
2 2
3SHA1 (numpy-1.16.6.zip) = 99bc8b723639066168cca0c9a3b68c36c73bddc2 3SHA1 (numpy-1.16.6.zip) = 99bc8b723639066168cca0c9a3b68c36c73bddc2
4RMD160 (numpy-1.16.6.zip) = af2c5ec5956986b061a5cf067de5685098b6846f 4RMD160 (numpy-1.16.6.zip) = af2c5ec5956986b061a5cf067de5685098b6846f
5SHA512 (numpy-1.16.6.zip) = c219841cc804c194a38b8e046b83265b8b7a35be8f33d68561ef17b085465dd11bd1e84fe1baea809af0efb09a9b13283f13728d125fcdd2221c30ec23fd0a50 5SHA512 (numpy-1.16.6.zip) = c219841cc804c194a38b8e046b83265b8b7a35be8f33d68561ef17b085465dd11bd1e84fe1baea809af0efb09a9b13283f13728d125fcdd2221c30ec23fd0a50
6Size (numpy-1.16.6.zip) = 5143340 bytes 6Size (numpy-1.16.6.zip) = 5143340 bytes
7SHA1 (patch-numpy_distutils_fcompiler_____init____.py) = 49d070da5b48bd9818b37ac3254341fa68503c53 7SHA1 (patch-numpy_distutils_fcompiler_____init____.py) = 49d070da5b48bd9818b37ac3254341fa68503c53
8SHA1 (patch-numpy_distutils_fcompiler_g95.py) = be73b64a3e551df998b6a904d6db762bf28a98ed 8SHA1 (patch-numpy_distutils_fcompiler_g95.py) = be73b64a3e551df998b6a904d6db762bf28a98ed
9SHA1 (patch-numpy_distutils_fcompiler_gnu.py) = 893b0556f869543074cb74d5d4385d2f155004ec 9SHA1 (patch-numpy_distutils_fcompiler_gnu.py) = 893b0556f869543074cb74d5d4385d2f155004ec
10SHA1 (patch-numpy_distutils_system__info.py) = f6414ce220c7f8ba7e139f5619080a78f6de8066 10SHA1 (patch-numpy_distutils_system__info.py) = 80659989fd4a8189a27e7f20802dda2151a4c4e1
11SHA1 (patch-numpy_linalg_lapack__litemodule.c) = b421455fdbb666c8075d8bffbeb59533434d23e6 11SHA1 (patch-numpy_linalg_lapack__litemodule.c) = b421455fdbb666c8075d8bffbeb59533434d23e6

cvs diff -r1.2 -r1.3 pkgsrc/math/py-numpy16/patches/patch-numpy_distutils_system__info.py (expand / switch to unified diff)

--- pkgsrc/math/py-numpy16/patches/patch-numpy_distutils_system__info.py 2020/10/12 21:52:03 1.2
+++ pkgsrc/math/py-numpy16/patches/patch-numpy_distutils_system__info.py 2021/04/20 20:58:39 1.3
@@ -1,30 +1,78 @@ @@ -1,30 +1,78 @@
1$NetBSD: patch-numpy_distutils_system__info.py,v 1.2 2020/10/12 21:52:03 bacon Exp $ 1$NetBSD: patch-numpy_distutils_system__info.py,v 1.3 2021/04/20 20:58:39 thor Exp $
2 2
3Disable openblas detection. In pkgsrc, use mk/blas.buildlink.mk. 3--- numpy/distutils/system_info.py.orig 2021-04-20 20:11:02.731971594 +0000
4 
5--- numpy/distutils/system_info.py.orig 2018-04-02 21:18:11.535155000 +0000 
6+++ numpy/distutils/system_info.py 4+++ numpy/distutils/system_info.py
7@@ -1531,12 +1531,12 @@ class lapack_opt_info(system_info): 5@@ -82,6 +82,19 @@ The order of finding the locations of re
 6 3. ALL section in site.cfg
 7 Only the first complete match is returned.
 8
 9+Note that blas_opt_info and lapack_opt_info honor the NPY_BLAS_ORDER
 10+and NPY_LAPACK_ORDER environment variables to determine the order in which
 11+specific BLAS and LAPACK libraries are searched for.
 12+
 13+This search (or autodetection) can be bypassed by defining the environment
 14+variables NPY_BLAS_LIBS and NPY_LAPACK_LIBS, which should then contain the
 15+exact linker flags to use (language will be set to F77). Building against
 16+Netlib BLAS/LAPACK or stub files, in order to be able to switch BLAS and LAPACK
 17+implementations at runtime. If using this to build NumPy itself, it is
 18+recommended to also define NPY_CBLAS_LIBS (assuming your BLAS library has a
 19+CBLAS interface) to enable CBLAS usage for matrix multiplication (unoptimized
 20+otherwise).
 21+
 22 Example:
 23 ----------
 24 [ALL]
 25@@ -1542,8 +1555,24 @@ class lapack_opt_info(system_info):
 26
 27 notfounderror = LapackNotFoundError
 28
 29+ def _calc_info_from_envvar(self):
 30+ info = {}
 31+ info['language'] = 'f77'
 32+ info['libraries'] = []
 33+ info['include_dirs'] = []
 34+ info['define_macros'] = []
 35+ info['extra_link_args'] = os.environ['NPY_LAPACK_LIBS'].split()
 36+ self.set_info(**info)
 37+ return True
 38+
 39 def calc_info(self):
 40
 41+ if 'NPY_LAPACK_LIBS' in os.environ:
 42+ # Bypass autodetection, set language to F77 and use env var linker
 43+ # flags directly
 44+ self._calc_info_from_envvar()
 45+ return
 46+
 47 lapack_mkl_info = get_info('lapack_mkl')
 48 if lapack_mkl_info:
8 self.set_info(**lapack_mkl_info) 49 self.set_info(**lapack_mkl_info)
9 return 50@@ -1621,8 +1650,28 @@ class blas_opt_info(system_info):
 51
 52 notfounderror = BlasNotFoundError
 53
 54+ def _calc_info_from_envvar(self):
 55+ info = {}
 56+ info['language'] = 'f77'
 57+ info['libraries'] = []
 58+ info['include_dirs'] = []
 59+ info['define_macros'] = []
 60+ info['extra_link_args'] = os.environ['NPY_BLAS_LIBS'].split()
 61+ if 'NPY_CBLAS_LIBS' in os.environ:
 62+ info['define_macros'].append(('HAVE_CBLAS', None))
 63+ info['extra_link_args'].extend(
 64+ os.environ['NPY_CBLAS_LIBS'].split())
 65+ self.set_info(**info)
 66+ return True
 67+
 68 def calc_info(self):
10  69
11- openblas_info = get_info('openblas_lapack') 70+ if 'NPY_BLAS_LIBS' in os.environ:
12+ openblas_info = None 71+ # Bypass autodetection, set language to F77 and use env var linker
13 if openblas_info: 72+ # flags directly
14 self.set_info(**openblas_info) 73+ self._calc_info_from_envvar()
15 return 74+ return
16  75+
17- openblas_info = get_info('openblas_clapack') 76 blas_mkl_info = get_info('blas_mkl')
18+ openblas_info = None 77 if blas_mkl_info:
19 if openblas_info: 78 self.set_info(**blas_mkl_info)
20 self.set_info(**openblas_info) 
21 return 
22@@ -1642,7 +1642,7 @@ class blas_opt_info(system_info): 
23 self.set_info(**blis_info) 
24 return 
25  
26- openblas_info = get_info('openblas') 
27+ openblas_info = None 
28 if openblas_info: 
29 self.set_info(**openblas_info) 
30 return