summaryrefslogtreecommitdiff
blob: 6f519f1858391f3a6d0d8e2476e01e786120523f (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
64
65
66
67
68
69
70
71
# 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_3,3_4} )

inherit distutils-r1 multilib

PN3="${PN}3"
P3="${PN3}-${PV}"

DESCRIPTION="DNS toolkit for Python"
HOMEPAGE="http://www.dnspython.org/ http://pypi.python.org/pypi/dnspython"
SRC_URI="http://www.dnspython.org/kits/${PV}/${P}.tar.gz
	http://www.dnspython.org/kits3/${PV}/${P3}.zip"

LICENSE="ISC"
SLOT="0"
KEYWORDS="~alpha ~amd64 ~arm ~hppa ~ia64 ~ppc ~ppc64 ~s390 ~sh ~sparc ~x86 ~x86-fbsd ~amd64-linux ~x86-linux ~ppc-macos ~x64-macos ~x86-solaris"
IUSE="examples test"

DEPEND="dev-python/pycrypto[${PYTHON_USEDEP}]
	app-arch/unzip"
RDEPEND="${DEPEND}"

S2="${S}"
S3="${WORKDIR}/${P3}"

# For testsuite
DISTUTILS_IN_SOURCE_BUILD=1

python_prepare() {
	if python_is_python3; then
		cp -r "${WORKDIR}/${P3}" "${BUILD_DIR}" || die
	else
		distutils-r1_python_prepare
	fi
}

python_compile() {
	if python_is_python3; then
		run_in_build_dir distutils-r1_python_compile
	else
		distutils-r1_python_compile
	fi
}

python_install(){
	if python_is_python3; then
		run_in_build_dir distutils-r1_python_install
	else
		distutils-r1_python_install
	fi
}

python_test() {
	if python_is_python3; then
		pushd "${S3}/tests" &> /dev/null
	else
		pushd "${S2}/tests" &> /dev/null
	fi
	"${PYTHON}" utest.py || die "tests failed under ${EPYTHON}"
	einfo "Testsuite passed under ${EPYTHON}"
	popd &> /dev/null
}

python_install_all() {
	use examples && local EXAMPLES=( examples/. )
	distutils-r1_python_install_all
}