summaryrefslogtreecommitdiff
blob: a825ba65513b24fa3e76641e8eb2f9a0f3935c4c (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
# Copyright 1999-2015 Gentoo Foundation
# Distributed under the terms of the GNU General Public License v2
# $Id$

EAPI=5
PYTHON_COMPAT=( python{2_7,3_4} pypy )
inherit eutils distutils-r1

DESCRIPTION="Automation tool"
HOMEPAGE="http://python-doit.sourceforge.net/ https://pypi.python.org/pypi/doit"
SRC_URI="mirror://pypi/${PN::1}/${PN}/${P}.tar.gz"

LICENSE="MIT"
SLOT="0"
KEYWORDS="~amd64"
IUSE="test"

RDEPEND="dev-python/pyinotify[${PYTHON_USEDEP}]
	dev-python/six[${PYTHON_USEDEP}]"
DEPEND="test? ( ${RDEPEND}
		dev-python/pytest[${PYTHON_USEDEP}]
		dev-python/mock[${PYTHON_USEDEP}] )"
# Required for test phase
DISTUTILS_IN_SOURCE_BUILD=1
DOCS=( AUTHORS CHANGES README.rst TODO.txt dev_requirements.txt )

python_prepare_all() {
	use test && DISTUTILS_IN_SOURCE_BUILD=1
	# Tests of this file fail due to setting of a tmp dir which can be fixed.
	# This known spurious cause does not warrant halting a testsuite
	rm -f tests/test_cmd_strace.py || die

	# These 2 tests succeed on running the suite a second time, so they are NOT broken
	# A gentoo test phase is run only once, so these unbroken tests can be safely skipped.
	sed -e s':testInit:_&:' -e s':testLoop:_&:' \
		-i tests/test_filewatch.py || die

	distutils-r1_python_prepare_all
}

python_test() {
	# Testsuite is designed to be run by py.test, called by runtests.py
	# https://bitbucket.org/schettino72/doit/issue/78/tests-that-fail-under-pypy
	if [[ "${EPYTHON}" == pypy-c2.0 ]]; then
		sed -e 's:test_corrupted_file:_&:' \
			-e 's:test_corrupted_file_unrecognized_excep_pdep:_&:' \
			-i tests/test_dependency.py || die
	elif [[ "${EPYTHON}" == python2.6 ]]; then
		rm -f tests/test___main__.py || die
		sed -e 's:test_invalid_param_stdout:_&:' \
			-i tests/test_action.py || die
		sed -e 's:test_run_wait:_&:' \
			-i tests/test_cmd_auto.py || die
	fi
	"${PYTHON}" runtests.py
}

src_install() {
	distutils-r1_src_install

	dodoc -r doc
	docompress -x /usr/share/doc/${PF}/doc
}