*/*: Clean PYTHON_COMPAT of obsolete impls
[gentoo.git] / dev-python / slimit / slimit-0.8.1-r1.ebuild
1 # Copyright 1999-2020 Gentoo Authors
2 # Distributed under the terms of the GNU General Public License v2
3
4 EAPI=6
5
6 PYTHON_COMPAT=( pypy3 python3_6 )
7 inherit distutils-r1
8
9 DESCRIPTION="A JavaScript minifier written in Python"
10 HOMEPAGE="https://slimit.readthedocs.io/en/latest/"
11 SRC_URI="https://github.com/rspivak/${PN}/archive/${PV}.tar.gz -> ${P}.tar.gz"
12
13 LICENSE="MIT"
14 SLOT="0"
15 KEYWORDS="~amd64 ~x86"
16 IUSE="test"
17 RESTRICT="!test? ( test )"
18
19 RDEPEND="dev-python/ply:=[${PYTHON_USEDEP}]
20         dev-python/setuptools[${PYTHON_USEDEP}]"
21 DEPEND="${RDEPEND}
22         test? (
23                 dev-python/pytest[${PYTHON_USEDEP}]
24                 dev-python/pytest-runner[${PYTHON_USEDEP}]
25         )"
26
27 PATCHES=( "${FILESDIR}/${P}-fix-python3.patch" )
28
29 python_compile() {
30         distutils-r1_python_compile
31
32         rm "${BUILD_DIR}"/lib/slimit/*tab.py || die
33
34         # Regenerate yacctab.py and lextab.py files to avoid warnings whenever
35         # the module is imported. See https://github.com/rspivak/slimit/issues/97
36         # for details
37         "${EPYTHON}" -B -c 'import slimit;slimit.minify("")' || die
38 }
39
40 python_test() {
41         esetup.py pytest --addopts "${BUILD_DIR}" || die "Testing failed with ${EPYTHON}"
42 }