summaryrefslogtreecommitdiff
blob: f6d521dfc629790390630041e6eb0b22e8405e06 (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
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
# Copyright 1999-2009 Gentoo Foundation
# Distributed under the terms of the GNU General Public License v2
# $Header: /var/cvsroot/gentoo-x86/dev-python/pysvn/pysvn-1.7.0.ebuild,v 1.2 2009/10/08 20:26:20 grobian Exp $

inherit eutils multilib python toolchain-funcs

DESCRIPTION="Object-oriented python bindings for subversion"
HOMEPAGE="http://pysvn.tigris.org/"
SRC_URI="http://pysvn.barrys-emacs.org/source_kits/${P}.tar.gz"

LICENSE="Apache-1.1"
SLOT="0"
KEYWORDS="~amd64 ~ppc ~x86 ~x86-freebsd ~ppc-macos"
IUSE="doc examples"

DEPEND="dev-util/subversion"
#	>=dev-python/pycxx-5.5.0"
RDEPEND="${DEPEND}"

S="${WORKDIR}/${P}/Source"

src_unpack() {
	python_version

	unpack ${A}

	# skip test test-06 if executed as root otherwise it will fail
	cd "${S/Source/}"
	epatch "${FILESDIR}/skip-root-test.patch"

	cd "${S}"
	epatch "${FILESDIR}"/${P}-darwin-freebsd.patch

	# since pysvn-1.6.3: These sources are not compatible with python =< 2.5
	# run the backport command to fix
	if [[ $PYVER_MAJOR -eq 2 ]] && [[ $PYVER_MINOR -lt 6 ]]; then
		einfo "prepare sources for python prior 2.6"
		python setup.py backport || die "backport failed"
	fi

	# needed to generate the Makefile
	python setup.py configure \
		--apr-inc-dir="${EPREFIX}"/usr/include/apr-1 \
		--svn-root-dir="${EPREFIX}"/usr \
		|| die "configure failed"

	# we want our CFLAGS as well
	sed -e 's:^\(CCFLAGS=\)\(.*\):\1$(CFLAGS) \2:g' \
		-e 's:^\(CCCFLAGS=\)\(.*\):\1$(CXXFLAGS) \2:g' \
		-e "/^CCC=/s:g++:$(tc-getCXX):" \
		-e "/^CC=/s:gcc:$(tc-getCC):" \
		-e "/^LDSHARED=/s:g++:$(tc-getCXX):" \
		-i Makefile \
		|| die "sed failed in Makefile"
}

src_test() {
	vecho ">>> Test phase [test]: ${CATEGORY}/${PF}"
	emake test || die "test-pysvn.so failed"
	emake -C ../Tests || die "test failed"
	vecho ">>> Test phase [none]: ${CATEGORY}/${PF}"
}

src_install() {
	local sitedir="$(python_get_sitedir)/${PN}"

	cd pysvn/

	exeinto ${sitedir}
	doexe _pysvn*$(get_modname) || die "doexe failed"
	insinto ${sitedir}
	doins __init__.py || die "doins failed"

	cd ../

	if use doc; then
		dohtml -r ../Docs/ || die "dohtml failed"
	fi

	if use examples; then
		docinto examples
		dodoc ../Examples/Client/* || die "dodoc examples failed"
	fi
}

pkg_postinst() {
	python_mod_optimize "$(python_get_sitedir)/${PN}"
}

pkg_postrm() {
	python_mod_cleanup "$(python_get_sitedir)/${PN}"
}