APKBUILD 2.69 KB
Newer Older
1
# Contributor: Francesco Colista <fcolista@alpinelinux.org>
2
# Contributor: Jakub Jirutka <jakub@jirutka.cz>
3
# Contributor: Martell Malone <martellmalone@gmail.com>
4
# Maintainer: Francesco Colista <fcolista@alpinelinux.org>
5 6
pkgname=py-numpy
_pkgname=numpy
7 8
pkgver=1.15.0
pkgrel=0
9 10
pkgdesc="Scientific tools for Python"
url="http://numpy.scipy.org/"
11
arch="all"
12
license="BSD"
13
options="!check"
14
makedepends="python2-dev py-setuptools python3-dev
15
	cython-dev openblas-dev>=0.3.0 gfortran py-nose"
16 17 18 19 20 21 22
subpackages="$pkgname-dev
	$pkgname-doc
	$pkgname-f2py::noarch
	py2-$_pkgname-f2py:_f2py:noarch
	py3-$_pkgname-f2py:_f2py:noarch
	py2-$_pkgname:_py
	py3-$_pkgname:_py"
23
source="https://github.com/numpy/numpy/releases/download/v$pkgver/$_pkgname-$pkgver.tar.gz
24
	site.cfg"
25
builddir="$srcdir/$_pkgname-$pkgver"
26

27
prepare() {
28
	default_prepare
29
	cp "$srcdir"/site.cfg "$builddir"/
30 31 32
}

build() {
33
	export Atlas=None
34
	LDFLAGS="$LDFLAGS -shared"
35

36
	cd "$builddir"
37 38
	python2 setup.py build config_fc --fcompiler=gnu95
	python3 setup.py build config_fc --fcompiler=gnu95
39
}
40 41

package() {
42
	cd "$builddir"
43 44 45

	local python; for python in python2 python3; do
		$python setup.py install --prefix=/usr --root="$pkgdir" \
46
			config_fc --fcompiler=gnu95
47 48 49 50 51 52 53 54 55 56 57 58
	done

	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"
59
		mv "$path"/* "$subpkgdir/$path"/
60 61 62 63 64 65 66 67 68 69 70 71 72 73
	done

	default_dev
}

f2py() {
	mkdir -p "$subpkgdir"
}

_f2py() {
	local pyver="${subpkgname:2:1}"
	local python="python$pyver"

	pkgdesc="f2py for numpy (for $python)"
74
	depends="py$pyver-numpy=$pkgver-r$pkgrel $python-dev"
75 76 77 78 79 80
	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
81
	mv "$pkgdir/$dir"/f2py "$subpkgdir/$dir"/
82 83 84 85 86 87 88 89 90 91 92 93 94 95
	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"
96
	mv "$pkgdir/$libdir"/* "$subpkgdir/$libdir"/
97 98 99 100 101
	rmdir -p "$pkgdir/$libdir" 2>/dev/null || true
}

_pylibdir() {
	"$1" -c 'import sysconfig; print(sysconfig.get_path("stdlib"))'
102 103
}

104
sha512sums="a1f0f2a2227ee2ea0a7c2c6676be1d50f1b67cc58f409b3b1094de50390294c23509f88a394a390c57d03c2d5785256c12d8534ad87f6719f0ec4ea574de7ed6  numpy-1.15.0.tar.gz
105
21ca8db304cbbf5949f07702f2a42bb5e5a0d641921e36649555a41b0e48f04e96f53760417823177ac27f6de24b2191e6e1d5f0eb393beafa29f7484e23284f  site.cfg"