327fccd2a27ba0578e23c3ef1f949b0ae39e11fc
[gentoo.git] / dev-python / msgpack / msgpack-0.6.1.ebuild
1 # Copyright 1999-2019 Gentoo Authors
2 # Distributed under the terms of the GNU General Public License v2
3
4 EAPI=6
5 PYTHON_COMPAT=( python2_7 python3_{5,6,7} pypy )
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
20 DEPEND="
21         dev-python/setuptools[${PYTHON_USEDEP}]
22         native-extensions? (
23                 $(python_gen_cond_dep '>=dev-python/cython-0.16[${PYTHON_USEDEP}]' 'python*')
24         )
25         test? (
26                 dev-python/six[${PYTHON_USEDEP}]
27                 dev-python/pytest[${PYTHON_USEDEP}]
28         )
29 "
30
31 python_prepare_all() {
32         # Remove pre-generated cython files
33         rm msgpack/{_packer,_unpacker,_cmsgpack}.pyx || die
34
35         if ! use native-extensions ; then
36                 sed -i -e "/have_cython/s:True:False:" ./setup.py || die
37         fi
38         distutils-r1_python_prepare_all
39 }
40
41 python_test() {
42         py.test -v test || die "Tests fail with ${EPYTHON}"
43 }