summaryrefslogtreecommitdiff
blob: dd3c08cec50818d9d3254f531c3c3423800ea070 (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
# Copyright 1999-2010 Gentoo Foundation
# Distributed under the terms of the GNU General Public License v2
# $Header: /var/cvsroot/gentoo-x86/dev-python/bsddb3/bsddb3-4.8.3.ebuild,v 1.4 2010/04/11 12:45:44 nixnut Exp $

EAPI="2"
SUPPORT_PYTHON_ABIS="1"

inherit db-use distutils eutils multilib

DESCRIPTION="Python bindings for Berkeley DB"
HOMEPAGE="http://www.jcea.es/programacion/pybsddb.htm http://pypi.python.org/pypi/bsddb3"
SRC_URI="http://pypi.python.org/packages/source/${PN:0:1}/${PN}/${P}.tar.gz"

LICENSE="BSD"
SLOT="0"
KEYWORDS="amd64 ~ia64 ppc ~sparc ~x86"
IUSE=""
# Documentation missing in >=4.8.2 tarball.
# IUSE="doc"

RDEPEND=">=sys-libs/db-4.6"
DEPEND="${RDEPEND}
	dev-python/setuptools"
#	doc? ( dev-python/sphinx )

DOCS="TODO.txt"

src_prepare() {
	distutils_src_prepare

	epatch "${FILESDIR}/${P}-BSDDB_TEST_PATH.patch"
}

src_compile() {
	local DB_VER
	if has_version sys-libs/db:4.8; then
		DB_VER="4.8"
	elif has_version sys-libs/db:4.7; then
		DB_VER="4.7"
	else
		DB_VER="4.6"
	fi

	sed -i \
		-e "s/dblib = 'db'/dblib = '$(db_libname ${DB_VER})'/" \
		setup2.py setup3.py || die "sed failed"

	distutils_src_compile \
		"--berkeley-db=/usr" \
		"--berkeley-db-incdir=$(db_includedir ${DB_VER})" \
		"--berkeley-db-libdir=/usr/$(get_libdir)"

#	if use doc; then
#		mkdir html
#		sphinx-build docs html || die "Generation of documentation failed"
#	fi
}

src_test() {
	tests() {
		rm -f build
		ln -s build-${PYTHON_ABI} build

		echo BSDDB_TEST_PATH="${T}/tests-${PYTHON_ABI}" "$(PYTHON)" test.py
		BSDDB_TEST_PATH="${T}/tests-${PYTHON_ABI}" "$(PYTHON)" test.py
	}
	python_execute_function tests
}

src_install() {
	distutils_src_install

	rm -fr "${D}"usr/lib*/python*/site-packages/${PN}/tests

#	use doc && dohtml -r html/*
}