6eb049a889ed7b6b15b801c08e9450deeb553f01
[gentoo.git] / dev-python / jaraco-stream / jaraco-stream-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}} )
7
8 inherit distutils-r1
9
10 MY_PN="${PN/-/.}"
11 DESCRIPTION="Routines for handling streaming data"
12 HOMEPAGE="https://github.com/jaraco/jaraco.stream"
13 SRC_URI="mirror://pypi/${PN:0:1}/${MY_PN}/${MY_PN}-${PV}.tar.gz"
14
15 LICENSE="MIT"
16 SLOT="0"
17 KEYWORDS="~amd64 ~x86"
18 IUSE="doc test"
19 RESTRICT="!test? ( 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         test? (
29                 ${RDEPEND}
30                 >=dev-python/pytest-2.8[${PYTHON_USEDEP}]
31                 dev-python/more-itertools[${PYTHON_USEDEP}]
32         )
33         doc? (
34                 >=dev-python/jaraco-packaging-3.2[${PYTHON_USEDEP}]
35                 >=dev-python/rst-linker-1.9[${PYTHON_USEDEP}]
36                 dev-python/sphinx[${PYTHON_USEDEP}]
37         )
38 "
39
40 S="${WORKDIR}/${MY_PN}-${PV}"
41
42 python_compile_all() {
43         if use doc; then
44                 sphinx-build docs docs/_build/html || die
45                 HTML_DOCS=( docs/_build/html/. )
46         fi
47 }
48
49 python_test() {
50         # Skip one test which requires network access
51         # Override pytest options to skip flake8
52         PYTHONPATH=. pytest -vv --ignore=jaraco/stream/test_gzip.py \
53                 --override-ini="addopts=--doctest-modules" \
54                 || die "tests failed with ${EPYTHON}"
55 }
56
57 # https://wiki.gentoo.org/wiki/Project:Python/Namespace_packages#File_collisions_between_pkgutil-style_packages
58 python_install() {
59         rm "${BUILD_DIR}"/lib/jaraco/__init__.py || die
60         # note: eclass may default to --skip-build in the future
61         distutils-r1_python_install --skip-build
62 }