summaryrefslogtreecommitdiff
blob: 3a1c537b0c2f1684214d86b0213f69008605c5a7 (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
# Copyright 1999-2019 Gentoo Authors
# Distributed under the terms of the GNU General Public License v2

EAPI=6

PYTHON_COMPAT=( python2_7 python3_{5,6} )

inherit distutils-r1 toolchain-funcs

DESCRIPTION="Simulating dynamics of open quantum systems in Python."
HOMEPAGE="http://qutip.org"
SRC_URI="https://github.com/qutip/qutip/archive/v$PV.tar.gz -> $P.tar.gz"

LICENSE="BSD"
SLOT="0"
KEYWORDS="~amd64 ~x86"
IUSE="openmp test"
RESTRICT="!test? ( test )"

RDEPEND="dev-python/cython[${PYTHON_USEDEP}]
	dev-python/numpy[${PYTHON_USEDEP}]
	dev-python/matplotlib[${PYTHON_USEDEP}]
	sci-libs/scipy[${PYTHON_USEDEP}]
"
DEPEND="${RDEPEND}
	test? ( dev-python/nose[${PYTHON_USEDEP}] )
"

pkg_pretend() {
	[[ ${MERGE_TYPE} != binary ]] && use openmp && tc-check-openmp
}

pkg_setup() {
	[[ ${MERGE_TYPE} != binary ]] && use openmp && tc-check-openmp
}

python_prepare_all() {
	sed -i setup.py \
		-e 's/_compiler_flags = .*$/_compiler_flags = []/' || die

	distutils-r1_python_prepare_all
}

python_configure_all() {
	use openmp && mydistutilsargs=( --with-openmp )
}

python_test() {
	cd "${BUILD_DIR}"/lib* || die
	${EPYTHON} -c "import qutip.testing as qt ; qt.run()" || die
}