d59f641f84e65165f5ba5066297cbd7b3a4509d6
[gentoo.git] / dev-python / backports-unittest-mock / backports-unittest-mock-1.3.ebuild
1 # Copyright 1999-2019 Gentoo Authors
2 # Distributed under the terms of the GNU General Public License v2
3
4 EAPI=6
5
6 # It is the developer's intention that backports.unittest_mock will be
7 # used even for Python 3: https://github.com/jaraco/jaraco.timing/pull/1
8 PYTHON_COMPAT=( python{2_7,3_5,3_6,3_7} pypy{,3} )
9
10 inherit distutils-r1
11
12 MY_PN="${PN/-/.}"
13 MY_PN="${MY_PN//-/_}"
14 DESCRIPTION="Backport of unittest.mock"
15 HOMEPAGE="https://github.com/jaraco/backports.unittest_mock"
16 SRC_URI="mirror://pypi/${PN:0:1}/${MY_PN}/${MY_PN}-${PV}.tar.gz"
17
18 LICENSE="MIT"
19 SLOT="0"
20 KEYWORDS="alpha amd64 arm arm64 hppa ia64 m68k ~mips ppc ppc64 s390 sh sparc x86"
21 IUSE="doc test"
22 RESTRICT="!test? ( test )"
23
24 RDEPEND="dev-python/backports[${PYTHON_USEDEP}]
25         dev-python/mock[${PYTHON_USEDEP}]"
26 DEPEND="dev-python/setuptools[${PYTHON_USEDEP}]
27         >=dev-python/setuptools_scm-1.15.0[${PYTHON_USEDEP}]
28         doc? (
29                 dev-python/jaraco-packaging[${PYTHON_USEDEP}]
30                 >=dev-python/rst-linker-1.9[${PYTHON_USEDEP}]
31                 >=dev-python/sphinx-1.5.2[${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         py.test -v || die "tests failed with ${EPYTHON}"
51 }
52
53 python_install() {
54         # avoid a collision with dev-python/backports
55         rm "${BUILD_DIR}"/lib/backports/__init__.py || die
56         distutils-r1_python_install --skip-build
57 }