diff options
author | Jakub Jirutka <jakub@jirutka.cz> | 2017-02-20 20:50:31 +0100 |
---|---|---|
committer | Jakub Jirutka <jakub@jirutka.cz> | 2017-02-20 20:59:40 +0100 |
commit | e527703280a377c9ea25e22a2cda1ffec42cce96 (patch) | |
tree | 93435b53b83930d220e41d49a76816947ec03fbe /community | |
parent | 589a28b5117ef06cc1ec1f6e3b4195965fdb0c72 (diff) | |
download | aports-e527703280a377c9ea25e22a2cda1ffec42cce96.tar.bz2 aports-e527703280a377c9ea25e22a2cda1ffec42cce96.tar.xz |
community/py-numpy: add py2/py3 and f2py subpkgs, move tests to -dev
Diffstat (limited to 'community')
-rw-r--r-- | community/py-numpy/APKBUILD | 85 |
1 files changed, 75 insertions, 10 deletions
diff --git a/community/py-numpy/APKBUILD b/community/py-numpy/APKBUILD index 4535c6c3e2..193137c56a 100644 --- a/community/py-numpy/APKBUILD +++ b/community/py-numpy/APKBUILD @@ -1,4 +1,5 @@ # Contributor: Francesco Colista <fcolista@alpinelinux.org> +# Contributor: Jakub Jirutka <jakub@jirutka.cz> # Maintainer: Francesco Colista <fcolista@alpinelinux.org> pkgname=py-numpy _pkgname=numpy @@ -9,10 +10,15 @@ url="http://numpy.scipy.org/" arch="all" license="BSD" depends="gfortran" -depends_dev="python2-dev openblas-dev py-setuptools py-nose cython-dev py-numpy" -makedepends="$depends_dev" -install="" -subpackages="$pkgname-dev $pkgname-doc" +depends_dev="python2-dev python3-dev cython-dev openblas-dev" +makedepends="$depends_dev py-setuptools py-nose" +subpackages="$pkgname-dev + $pkgname-doc + $pkgname-f2py::noarch + py2-$_pkgname-f2py:_f2py:noarch + py3-$_pkgname-f2py:_f2py:noarch + py2-$_pkgname:_py + py3-$_pkgname:_py" source="https://github.com/numpy/numpy/releases/download/v$pkgver/$_pkgname-$pkgver.tar.gz numpy-1.11.0-musl.patch site.cfg" @@ -24,18 +30,77 @@ prepare() { } build() { - cd "$builddir" export Atlas=None LDFLAGS="$LDFLAGS -shared" - python2 setup.py build config_fc --fcompiler=gnu95 || return 1 -} + cd "$builddir" + python2 setup.py build config_fc --fcompiler=gnu95 || return 1 + python3 setup.py build config_fc --fcompiler=gnu95 || return 1 +} package() { cd "$builddir" - python2 setup.py install --prefix=/usr --root="$pkgdir" config_fc --fcompiler=gnu95 || return 1 - install -m755 -d "$pkgdir"/usr/share/licenses/custom/$pkgname - install -m644 LICENSE.txt "$pkgdir"/usr/share/licenses/custom/$pkgname/LICENSE + + local python; for python in python2 python3; do + $python setup.py install --prefix=/usr --root="$pkgdir" \ + config_fc --fcompiler=gnu95 || return 1 + done + + install -D -m 644 doc/f2py/f2py.1 \ + "$pkgdir"/usr/share/man/man1/f2py.1 || return 1 + install -D -m 644 LICENSE.txt \ + "$pkgdir"/usr/share/licenses/$pkgname/LICENSE +} + +dev() { + cd "$pkgdir" + + # Move tests to -dev subpackage. + find usr/lib/python* -type d -name tests | while read path; do + mkdir -p "$subpkgdir/$path" + mv "$path"/* "$subpkgdir/$path"/ || return 1 + done + + default_dev +} + +f2py() { + mkdir -p "$subpkgdir" +} + +_f2py() { + local pyver="${subpkgname:2:1}" + local python="python$pyver" + + pkgdesc="f2py for numpy (for $python)" + depends="py$pyver-numpy" + install_if="$pkgname-f2py=$pkgver-r$pkgrel $python" + [ "$pyver" = 3 ] || replaces="$pkgname" + + local dir="$(_pylibdir $python)/site-packages/numpy" + + mkdir -p "$subpkgdir/$dir" "$subpkgdir"/usr/bin + mv "$pkgdir/$dir"/f2py "$subpkgdir/$dir"/ || return 1 + mv "$pkgdir"/usr/bin/f2py$pyver "$subpkgdir"/usr/bin/ +} + +_py() { + local pyver="${subpkgname:2:1}" + local python="python$pyver" + + pkgdesc="$pkgdesc $pyver" + install_if="$pkgname=$pkgver-r$pkgrel $python" + [ "$pyver" = 3 ] || replaces="$pkgname" + + local libdir=$(_pylibdir $python) + + mkdir -p "$subpkgdir/$libdir" + mv "$pkgdir/$libdir"/* "$subpkgdir/$libdir"/ || return 1 + rmdir -p "$pkgdir/$libdir" 2>/dev/null || true +} + +_pylibdir() { + "$1" -c 'import sysconfig; print(sysconfig.get_path("stdlib"))' } sha512sums="f2474088dbb2bc40e0f2cde06592173a1fdfad53307d430c07eb6bd3bcf3ce4a3c10c0321000d6f3de8d9b818e18f2a0962fbdc9d08a491ab698929a7d1fceb7 numpy-1.12.0.tar.gz |