436155a5b533d73571a3db59f211d3248b4e1011
[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
21 DEPEND="
22         dev-python/setuptools[${PYTHON_USEDEP}]
23         dev-python/nose[${PYTHON_USEDEP}]
24         app-arch/unzip"
25 RDEPEND="${DEPEND}"
26
27 PATCHES=(
28         "${FILESDIR}"/${P}-test-py3.patch
29 )
30
31 python_test() {
32         # See setup.py; line 72. Again "${S}" is used for reading tests
33         # Since py3_2 is first in the queue it needs its own copy
34         # or else all py2s to follow will be reading read py3 tests
35         if [[ "${EPYTHON}" =~ 'python3' ]]; then
36                 cd "${BUILD_DIR}"/lib || die
37                 cp -a "${S}"/tests/ .  || die
38                 2to3 -w tests/tests.py || die
39                 "${PYTHON}" tests/tests.py || die
40                 rm -rf tests/ || die
41         else
42                 "${PYTHON}" tests/tests.py || die
43         fi
44 }