aboutsummaryrefslogtreecommitdiff
blob: 8eb0fc83aaf7318a4a22b097aa747d748b37fc9c (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
# Copyright 1999-2012 Gentoo Foundation
# Distributed under the terms of the GNU General Public License v2
# $Header: $

EAPI=4

SUPPORT_PYTHON_ABIS="1"
RESTRICT_PYTHON_ABIS="3*"

inherit python

DESCRIPTION="Bayesian Photometric Redshifts"
HOMEPAGE="http://www.its.caltech.edu/~coe/BPZ/"
SRC_URI="${HOMEPAGE}/${P}.tar.gz"

LICENSE="as-is"
SLOT="0"
KEYWORDS="~amd64 ~x86"
IUSE=""

RDEPEND="dev-python/numpy
	|| ( dev-python/matplotlib dev-python/python-biggles )"
DEPEND="test? ( ${RDEPEND} )"

src_prepare() {
	sed -i -e 's/TkAgg/Agg/g' bpz.py plots/probplot.py plots/coeplot.py
}

src_test() {
	cd test
	testing() {
		export BPZPATH="${S}" PYTHONPATH="${S}"
		"$(PYTHON)" ../bpz.py UDFtest.cat -INTERP 2
		"$(PYTHON)" ../bpzfinalize.py UDFtest
		"$(PYTHON)" ../plots/webpage.py UDFtest
	}
	python_execute_function testing
}

src_install() {
	insinto /usr/share/bpz
	doins -r FILTER SED AB
	installation() {
		insinto $(python_get_sitedir)/bpz
		doins -r *.py plots
	}
	python_execute_function installation
	cat <<-EOF > bpz
		#!$(type -P sh)
		sitedir=\$(python -c 'from distutils.sysconfig import get_python_lib; print(get_python_lib())')
		BPZPATH=${EPREFIX}/usr/share/bpz python \${sitedir}/bpz/bpz.py \$@
	EOF
	exeinto /usr/bin
	doexe bpz
}