*/*: Clean PYTHON_COMPAT of obsolete impls
[gentoo.git] / dev-python / icalendar / icalendar-3.11.7-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=( python2_7 python3_6 )
7
8 inherit distutils-r1
9
10 MY_PN="collective-${PN}"
11
12 DESCRIPTION="Package used for parsing and generating iCalendar files (RFC 2445)"
13 HOMEPAGE="https://github.com/collective/icalendar"
14 SRC_URI="mirror://pypi/i/${PN}/${P}.tar.gz"
15
16 LICENSE="BSD"
17 SLOT="0"
18 KEYWORDS="~amd64 ~x86"
19 IUSE="doc test"
20 RESTRICT="!test? ( test )"
21 DOCS="README.rst"
22
23 RDEPEND="
24         dev-python/pytz[${PYTHON_USEDEP}]
25         dev-python/setuptools[${PYTHON_USEDEP}]
26         dev-python/python-dateutil[${PYTHON_USEDEP}]"
27
28 DEPEND="
29         ${RDEPEND}
30         doc? ( dev-python/sphinx[${PYTHON_USEDEP}] )
31         test? ( dev-python/python-dateutil:0[${PYTHON_USEDEP}]
32                 dev-python/pytest[${PYTHON_USEDEP}]
33                 dev-python/coverage[${PYTHON_USEDEP}] )"
34
35 python_prepare_all() {
36         # reset conf.py to not read version from an installed instance
37         sed -e "s:pkg_resources.get_distribution('icalendar').version:'3.9.0':" \
38                 -i docs/conf.py || die
39         distutils-r1_python_prepare_all
40 }
41
42 python_compile_all() {
43         if use doc; then
44                 pushd docs > /dev/null
45                 emake text
46                 popd > /dev/null
47                 DOCS=( ${DOCS} docs/_build/text/*.txt )
48         fi
49 }
50
51 python_test() {
52         # From tox.ini
53         coverage run --source=src/icalendar --omit=*/tests/* --module \
54                 pytest src/icalendar || die "test failed under ${EPYTHON}"
55 }