7ed163fcb2ae79bcf67cec52ab63d650cae67ff5
[gentoo.git] / dev-python / msgpack / msgpack-0.5.6.ebuild
1 # Copyright 1999-2020 Gentoo Authors
2 # Distributed under the terms of the GNU General Public License v2
3
4 EAPI=6
5 PYTHON_COMPAT=( python2_7 python3_{6,7} )
6
7 inherit distutils-r1
8
9 DESCRIPTION="MessagePack (de)serializer for Python"
10 HOMEPAGE="https://msgpack.org
11         https://github.com/msgpack/msgpack-python/
12         https://pypi.org/project/msgpack/"
13 SRC_URI="mirror://pypi/${PN:0:1}/${PN}/${P}.tar.gz"
14
15 LICENSE="Apache-2.0"
16 SLOT="0"
17 KEYWORDS="amd64 arm ~arm64 ppc x86"
18 IUSE="+native-extensions test"
19 RESTRICT="!test? ( test )"
20
21 DEPEND="
22         dev-python/setuptools[${PYTHON_USEDEP}]
23         native-extensions? (
24                 $(python_gen_cond_dep '>=dev-python/cython-0.16[${PYTHON_USEDEP}]' 'python*')
25         )
26         test? (
27                 dev-python/six[${PYTHON_USEDEP}]
28                 dev-python/pytest[${PYTHON_USEDEP}]
29         )
30 "
31
32 python_prepare_all() {
33         # Remove pre-generated cython files
34         rm msgpack/{_packer,_unpacker}.cpp || die
35
36         if ! use native-extensions ; then
37                 sed -i -e "/have_cython/s:True:False:" ./setup.py || die
38         fi
39         distutils-r1_python_prepare_all
40 }
41
42 python_test() {
43         py.test -v test || die "Tests fail with ${EPYTHON}"
44 }