blob: c300836c33d822affb104fec7ce8033292455ca3 (
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
|
# Copyright 2025 Gentoo Authors
# Distributed under the terms of the GNU General Public License v2
EAPI=8
DISTUTILS_EXT=1
DISTUTILS_USE_PEP517=setuptools
PYTHON_COMPAT=( python3_{11..14} )
inherit db-use distutils-r1 pypi
DESCRIPTION="Python bindings for Oracle Berkeley DB"
HOMEPAGE="
https://www.jcea.es/programacion/pybsddb.htm
https://pypi.org/project/berkeleydb/
"
LICENSE="BSD"
SLOT="0"
KEYWORDS="~amd64"
IUSE="test"
RESTRICT="!test? ( test )"
RDEPEND="
<sys-libs/db-6.0:=
|| (
sys-libs/db:5.3
sys-libs/db:4.8
)
"
BDEPEND="
test? (
dev-python/packaging[${PYTHON_USEDEP}]
dev-python/test[${PYTHON_USEDEP}]
)
"
python_prepare_all() {
distutils-r1_python_prepare_all
# This list should be kept in sync with setup.py.
if [[ -z ${DB_VER} ]]; then
for DB_VER in 5.3 4.8; do
has_version "sys-libs/db:${DB_VER}" && break
done
fi
# Force version.
sed -e "s/db_ver = None/db_ver = (${DB_VER%.*}, ${DB_VER#*.})/" \
-e "s/dblib = 'db'/dblib = '$(db_libname ${DB_VER})'/" \
-i setup3.py || die
# Fix the build
mv setup3.py setup.py || die
sed -e 's|setuptools.build_meta:__legacy__|setuptools.build_meta|' -i pyproject.toml || die
# no build dir
sed -e "/os.chdir('build')/d" -i test.py || die
# Set it ourselves in the test phase
sed -e "/os.environ\['BERKELEYDB_SO_PATH'\]/d" -i test.py || die
}
python_configure_all() {
DISTUTILS_ARGS=(
--berkeley-db="${EPREFIX}/usr"
--berkeley-db-incdir="$(db_includedir ${DB_VER})"
--berkeley-db-libdir="${EPREFIX}/usr/$(get_libdir)"
)
}
python_test() {
local -x BERKELEYDB_SO_PATH="${BUILD_DIR}"
"${EPYTHON}" test.py -vv || die "Testing failed with ${EPYTHON}"
}
|