summaryrefslogtreecommitdiff
blob: 24b3d53fc93d61e666f4ad4421ccc84f82fd1643 (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
# Copyright 1999-2011 Gentoo Foundation
# Distributed under the terms of the GNU General Public License v2
# $Header: /var/cvsroot/gentoo-x86/dev-python/pyamg/pyamg-2.0.0.ebuild,v 1.3 2011/08/08 18:32:44 hwoarang Exp $

EAPI=3
PYTHON_DEPEND="2"
SUPPORT_PYTHON_ABIS="1"
RESTRICT_PYTHON_ABIS="3.*"

inherit distutils eutils

DESCRIPTION="Algebraic multigrid solvers in Python"
HOMEPAGE="http://code.google.com/p/pyamg/"
SRC_URI="http://${PN}.googlecode.com/files/${P}.tar.gz"

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

RESTRICT="test" # quite buggy

RDEPEND="sci-libs/scipy"
DEPEND="${RDEPEND}
	doc? ( dev-python/sphinx )
	test? ( dev-python/nose )"

src_prepare() {
	epatch "${FILESDIR}"/${PV}-stencil.patch
}

src_compile() {
	distutils_src_compile
	if use doc; then
		cd "${S}/Docs"
		PYTHONPATH=$(ls -d "${S}"/build-$(PYTHON -f --ABI)/lib*) emake html
	fi
}

src_test() {
	testing() {
		"$(PYTHON)" setup.py \
			build -b "build-${PYTHON_ABI}" \
			install --home="${S}/test-${PYTHON_ABI}"
		pushd "${S}/test-${PYTHON_ABI}/lib/python" > /dev/null
		PYTHONPATH=. "$(PYTHON)" -c "import pyamg; pyamg.test()" 2>&1 | tee test.log
		grep -Eq "^(ERROR|FAIL):" test.log && return 1
		popd > /dev/null
		rm -fr test-${PYTHON_ABI}
	}
	python_execute_function testing
}

src_install() {
	distutils_src_install
	use doc && dohtml -r Docs/build/html/*
}