summaryrefslogtreecommitdiff
blob: 5517872d39077c34f8fc5eae1bce1c3ef5fa1768 (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-2017 Gentoo Foundation
# Distributed under the terms of the GNU General Public License v2

EAPI=6

PYTHON_COMPAT=( python2_7 python3_{4,5,6} )

inherit distutils-r1

# change each new dynd version, to avoid git in tree dependency
DYND_PYTHON_GIT_SHA1=8cdef57e71c784d7fe1f3f97a2ce2ce5727a89f1

DESCRIPTION="Python exposure of multidimensionnal array library libdynd"
HOMEPAGE="http://libdynd.org/"
SRC_URI="https://github.com/libdynd/${PN}/archive/v${PV}.tar.gz -> ${P}.tar.gz"

LICENSE="BSD"
SLOT="0"
KEYWORDS="amd64 ~x86 ~amd64-linux ~x86-linux"
IUSE="doc test"
REQUIRED_USE="${PYTHON_REQUIRED_USE}"

RDEPEND="
	${PYTHON_DEPS}
	~dev-libs/libdynd-${PV}
	dev-python/numpy[${PYTHON_USEDEP}]
"
DEPEND="${RDEPEND}
	dev-python/cython[${PYTHON_USEDEP}]
	doc? ( dev-python/sphinx[${PYTHON_USEDEP}] )
	test? ( dev-python/nose[${PYTHON_USEDEP}] )
"

python_prepare_all() {
	# remove the version mangling from git stuff it requires a git clone
	# rather force set it a configure time
	sed -e "/--dirty/s/ver =.*/ver = 'v${PV}'/" \
		-e '/--always/d' \
		-i setup.py || die
	sed -e "s/get_git.*/set(DYND_PYTHON_GIT_SHA1 ${DYND_PYTHON_GIT_SHA1})/" \
		-e "s/git_describe.*/set(DYND_PYTHON_VERSION_STRING v${PV})/" \
		-e 's|-g -fomit-frame-pointer||' \
		-e 's|-Werror||g' \
		-i CMakeLists.txt || die

	distutils-r1_python_prepare_all
}

python_compile_all() {
	if use doc; then
		emake -C docs html
		HTML_DOCS=( docs/build/html/. )
	fi
}

python_test() {
	cd "${BUILD_DIR}/lib" || die
	PYTHONPATH=${BUILD_DIR}/lib nosetests -v || die
}