1 # Copyright 1999-2015 Gentoo Foundation
2 # Distributed under the terms of the GNU General Public License v2
6 PYTHON_COMPAT=( python{2_7,3_3,3_4} )
8 inherit db-use distutils-r1 multilib
10 DESCRIPTION="Python bindings for Berkeley DB"
11 HOMEPAGE="http://www.jcea.es/programacion/pybsddb.htm https://pypi.python.org/pypi/bsddb3"
12 SRC_URI="mirror://pypi/${PN:0:1}/${PN}/${P}.tar.gz"
16 KEYWORDS="~alpha ~amd64 ~arm ~ia64 ~ppc ~ppc64 ~sparc ~x86 ~amd64-linux ~x86-linux"
24 dev-python/setuptools[${PYTHON_USEDEP}]"
26 DISTUTILS_IN_SOURCE_BUILD=1
29 # This list should be kept in sync with setup.py.
30 if [[ -z ${DB_VER} ]]; then
31 for DB_VER in 6.1 6.0 5.3 5.2 5.1 5.0 4.8 4.7; do
32 has_version "sys-libs/db:${DB_VER}" && break
37 sed -e "s/db_ver = None/db_ver = (${DB_VER%.*}, ${DB_VER#*.})/" \
38 -e "s/dblib = 'db'/dblib = '$(db_libname ${DB_VER})'/" \
39 -i setup2.py setup3.py || die
41 # Adjust test.py to look in build/lib.
42 sed -e "s/'lib.%s' % PLAT_SPEC/'lib'/" \
43 -i test2.py test3.py || die
45 distutils-r1_src_prepare
49 # These are needed for both build and install.
50 export BERKELEYDB_DIR="${EPREFIX}/usr"
51 export BERKELEYDB_INCDIR="$(db_includedir ${DB_VER})"
52 export BERKELEYDB_LIBDIR="${EPREFIX}/usr/$(get_libdir)"
53 export YES_I_HAVE_THE_RIGHT_TO_USE_THIS_BERKELEY_DB_VERSION=1
57 if ! python_is_python3; then
58 local -x CFLAGS="${CFLAGS} -fno-strict-aliasing"
60 distutils-r1_python_compile
64 if python_is_python3; then
65 PYTHONPATH=Lib3 "${PYTHON}" test3.py -v || die "Testing failed with ${EPYTHON}"
67 PYTHONPATH=Lib "${PYTHON}" test.py -v || die "Testing failed with ${EPYTHON}"
71 python_install_all() {
72 use doc && local HTML_DOCS=( docs/html/. )
73 distutils-r1_python_install_all