aboutsummaryrefslogtreecommitdiff
blob: 2f946170d4c9972b55cff3ca9ccb9977d055377f (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
# Copyright 1999-2014 Gentoo Foundation
# Distributed under the terms of the GNU General Public License v2

EAPI=5

PYTHON_COMPAT=( python2_7 )

inherit distutils-r1 multilib

DESCRIPTION="Sparse linear algebra extension for Python"
SRC_URI="mirror://sourceforge/${PN}/${P}.tar.gz"
HOMEPAGE="http://pysparse.sourceforge.net/"

IUSE="doc examples"
SLOT="0"
KEYWORDS="~amd64 ~x86"
LICENSE="BSD"

RDEPEND="
	dev-python/numpy
	sci-libs/superlu
	<=sci-libs/umfpack-5.4.0"
DEPEND="${DEPEND}"

PATCHES=(
	"${FILESDIR}"/${P}-setup.patch
	"${FILESDIR}"/${P}-superlu3.patch
	)

pc_libs() {
	$(tc-getPKG_CONFIG) --libs-only-l $@ | \
	sed -e 's/[ ]-l*\(pthread\|m\)[ ]*//g' \
	-e 's/^-l/"/' -e 's/[ ]*-l/","/g' -e 's/[ ]*$/"/g'
}

python_prepare_all() {
	distutils-r1_python_prepare_all
	sed \
		-e "/libraries_list/s:'lapack', 'blas':$(pc_libs blas lapack):g" \
		-e "/use_users_umfpack/s:True:False:g" \
		-i setup.py || die
}

python_test() {
	for t in Test/test{Umfpack,Superlu}.py; do
		${PYTHON} ${t} || die
	done
}

python_install_all() {
	distutils-r1_python_install

	use doc && dodoc Doc/*.pdf

	if use examples; then
		insinto /usr/share/${PN}/
		doins -r Examples
	fi
}