*/*: Clean PYTHON_COMPAT of obsolete impls
[gentoo.git] / dev-python / jaraco-functools / jaraco-functools-2.0-r1.ebuild
1 # Copyright 1999-2020 Gentoo Authors
2 # Distributed under the terms of the GNU General Public License v2
3
4 EAPI=7
5
6 PYTHON_COMPAT=( pypy3 python{2_7,3_{6,7,8}} )
7
8 inherit distutils-r1
9
10 MY_PN="${PN/-/.}"
11 DESCRIPTION="Additional functions used by other projects by developer jaraco"
12 HOMEPAGE="https://github.com/jaraco/jaraco.functools"
13 SRC_URI="mirror://pypi/${PN:0:1}/${MY_PN}/${MY_PN}-${PV}.tar.gz"
14 S="${WORKDIR}/${MY_PN}-${PV}"
15
16 LICENSE="MIT"
17 SLOT="0"
18 KEYWORDS="amd64 ~arm arm64 ~hppa ~ia64 ~ppc64 ~sparc ~x86"
19 IUSE="test"
20 RESTRICT="!test? ( test )"
21
22 RDEPEND="
23         >=dev-python/namespace-jaraco-2[${PYTHON_USEDEP}]
24         dev-python/more-itertools[${PYTHON_USEDEP}]
25         $(python_gen_cond_dep 'dev-python/backports-functools-lru-cache[${PYTHON_USEDEP}]' python2_7)
26 "
27 DEPEND="dev-python/setuptools[${PYTHON_USEDEP}]
28         test? (
29                 ${RDEPEND}
30                 >=dev-python/pytest-2.8[${PYTHON_USEDEP}]
31                 dev-python/backports-unittest-mock[${PYTHON_USEDEP}]
32                 dev-python/jaraco-classes[${PYTHON_USEDEP}]
33                 dev-python/six[${PYTHON_USEDEP}]
34         )
35 "
36
37 PATCHES=( "${FILESDIR}/${P}-fix-py37-tests.patch" )
38
39 distutils_enable_sphinx docs \
40         ">=dev-python/jaraco-packaging-3.2" \
41         ">=dev-python/rst-linker-1.9"
42
43 python_prepare_all() {
44         # avoid a setuptools_scm dependency
45         sed -i "s:use_scm_version=True:version='${PV}',name='${PN//-/.}':" setup.py || die
46         sed -r -i "s:setuptools_scm[[:space:]]*([><=]{1,2}[[:space:]]*[0-9.a-zA-Z]+)[[:space:]]*::" \
47                 setup.cfg || die
48
49         distutils-r1_python_prepare_all
50 }
51
52 python_test() {
53         # Override pytest options to skip flake8
54         PYTHONPATH=. pytest -vv --override-ini="addopts=--doctest-modules" \
55                 || die "tests failed with ${EPYTHON}"
56 }
57
58 # https://wiki.gentoo.org/wiki/Project:Python/Namespace_packages#File_collisions_between_pkgutil-style_packages
59 python_install() {
60         rm "${BUILD_DIR}"/lib/jaraco/__init__.py || die
61         # note: eclass may default to --skip-build in the future
62         distutils-r1_python_install --skip-build
63 }