21bf458e20fc16016bcdded12aa11132cded1f31
[gentoo.git] / dev-python / ujson / ujson-1.33.ebuild
1 # Copyright 1999-2019 Gentoo Authors
2 # Distributed under the terms of the GNU General Public License v2
3
4 EAPI=5
5
6 # One test; FAIL: test_encodeToUTF8 (__main__.UltraJSONTests) under py2.5.
7 # Fix and repair and re-insert if it's REALLY needed
8 PYTHON_COMPAT=( python2_7 python3_5 )
9
10 inherit distutils-r1
11
12 DESCRIPTION="Ultra fast JSON encoder and decoder for Python"
13 HOMEPAGE="https://pypi.org/project/ujson/"
14 SRC_URI="mirror://pypi/${PN:0:1}/${PN}/${P}.zip"
15
16 LICENSE="BSD"
17 SLOT="0"
18 KEYWORDS="amd64 arm x86"
19 IUSE="test"
20 RESTRICT="!test? ( test )"
21
22 DEPEND="
23         dev-python/setuptools[${PYTHON_USEDEP}]
24         dev-python/nose[${PYTHON_USEDEP}]
25         app-arch/unzip"
26 RDEPEND="${DEPEND}"
27
28 PATCHES=(
29         "${FILESDIR}"/${P}-test-py3.patch
30 )
31
32 python_test() {
33         # See setup.py; line 72. Again "${S}" is used for reading tests
34         # Since py3_2 is first in the queue it needs its own copy
35         # or else all py2s to follow will be reading read py3 tests
36         if [[ "${EPYTHON}" =~ 'python3' ]]; then
37                 cd "${BUILD_DIR}"/lib || die
38                 cp -a "${S}"/tests/ .  || die
39                 2to3 -w tests/tests.py || die
40                 "${PYTHON}" tests/tests.py || die
41                 rm -rf tests/ || die
42         else
43                 "${PYTHON}" tests/tests.py || die
44         fi
45 }