aboutsummaryrefslogtreecommitdiffstats
path: root/community/py-numpy/APKBUILD
blob: 358be1f24c39e33d3a7df7ca1131d4db2380cb29 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
# Contributor: Francesco Colista <fcolista@alpinelinux.org>
# Contributor: Jakub Jirutka <jakub@jirutka.cz>
# Maintainer: Francesco Colista <fcolista@alpinelinux.org>
pkgname=py-numpy
_pkgname=numpy
pkgver=1.13.1
pkgrel=0
pkgdesc="Scientific tools for Python"
url="http://numpy.scipy.org/"
arch="all !s390x"
license="BSD"
options="!check"
makedepends="python2-dev py-setuptools python3-dev 
	cython-dev openblas-dev gfortran 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
	site.cfg"
builddir="$srcdir/$_pkgname-$pkgver"

prepare() {
	default_prepare
	cp "$srcdir"/site.cfg "$builddir"/
}

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

	cd "$builddir"
	python2 setup.py build config_fc --fcompiler=gnu95
	python3 setup.py build config_fc --fcompiler=gnu95
}

package() {
	cd "$builddir"

	local python; for python in python2 python3; do
		$python setup.py install --prefix=/usr --root="$pkgdir" \
			config_fc --fcompiler=gnu95 
	done

	install -D -m 644 doc/f2py/f2py.1 \
		"$pkgdir"/usr/share/man/man1/f2py.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"/
	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=$pkgver-r$pkgrel $python-dev"
	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"/
	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"/
	rmdir -p "$pkgdir/$libdir" 2>/dev/null || true
}

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

sha512sums="99a8cf06ae534decefeaff68195aae660f33e4845a5698dbe0f349bf1fb46a2147fb745d9a0f9a4d08eddbd8464e499f07c423fcb886cc8df6c1020fdedb8ec3  numpy-1.13.1.tar.gz
21ca8db304cbbf5949f07702f2a42bb5e5a0d641921e36649555a41b0e48f04e96f53760417823177ac27f6de24b2191e6e1d5f0eb393beafa29f7484e23284f  site.cfg"