dfe803bba472e372993b37eae2fdfe4dbd0aa3bc
[gentoo.git] / dev-python / jaraco-classes / jaraco-classes-2.0.ebuild
1 # Copyright 1999-2019 Gentoo Authors
2 # Distributed under the terms of the GNU General Public License v2
3
4 EAPI=7
5
6 # Tests fail with pypy
7 PYTHON_COMPAT=( pypy3 python{2_7,3_{5,6,7}} )
8
9 inherit distutils-r1
10
11 MY_PN="${PN/-/.}"
12 DESCRIPTION="Classes used by other projects by developer jaraco"
13 HOMEPAGE="https://github.com/jaraco/jaraco.classes"
14 SRC_URI="mirror://pypi/${PN:0:1}/${MY_PN}/${MY_PN}-${PV}.tar.gz"
15
16 LICENSE="MIT"
17 SLOT="0"
18 KEYWORDS="~amd64 ~arm64 ~x86"
19 IUSE="doc test"
20
21 RDEPEND="
22         >=dev-python/namespace-jaraco-2[${PYTHON_USEDEP}]
23         dev-python/six[${PYTHON_USEDEP}]
24 "
25 DEPEND="
26         dev-python/setuptools[${PYTHON_USEDEP}]
27         >=dev-python/setuptools_scm-1.15.0[${PYTHON_USEDEP}]
28         doc? (
29                 >=dev-python/jaraco-packaging-3.2[${PYTHON_USEDEP}]
30                 >=dev-python/rst-linker-1.9[${PYTHON_USEDEP}]
31                 dev-python/sphinx[${PYTHON_USEDEP}]
32         )
33         test? (
34                 ${RDEPEND}
35                 >=dev-python/pytest-2.8[${PYTHON_USEDEP}]
36         )
37 "
38
39 S="${WORKDIR}/${MY_PN}-${PV}"
40
41 python_compile_all() {
42         if use doc; then
43                         cd docs || die
44                         sphinx-build . _build/html || die
45                         HTML_DOCS=( docs/_build/html/. )
46         fi
47 }
48
49 python_test() {
50         # Avoid ImportMismatchError, override pytest options to skip flake8
51         pytest -vv "${BUILD_DIR}"/lib --override-ini="addopts=--doctest-modules" \
52                 || die "tests failed with ${EPYTHON}"
53 }
54
55 # https://wiki.gentoo.org/wiki/Project:Python/Namespace_packages#File_collisions_between_pkgutil-style_packages
56 python_install() {
57         rm "${BUILD_DIR}"/lib/jaraco/__init__.py || die
58         # note: eclass may default to --skip-build in the future
59         distutils-r1_python_install --skip-build
60 }