1{
2 lib,
3 buildPythonPackage,
4 pythonAtLeast,
5 python,
6 fetchPypi,
7 setuptools,
8 pkgs,
9}:
10
11buildPythonPackage rec {
12 pname = "bsddb3";
13 version = "6.2.9";
14 pyproject = true;
15
16 src = fetchPypi {
17 inherit pname version;
18 sha256 = "70d05ec8dc568f42e70fc919a442e0daadc2a905a1cfb7ca77f549d49d6e7801";
19 };
20
21 build-system = [ setuptools ];
22
23 buildInputs = [ pkgs.db ];
24
25 # See : https://github.com/NixOS/nixpkgs/pull/311198#discussion_r1599257522
26 # More details here : https://www.jcea.es/programacion/pybsddb.htm
27 disabled = pythonAtLeast "3.10";
28
29 # Path to database need to be set.
30 # Somehow the setup.py flag is not propagated.
31 #setupPyBuildFlags = [ "--berkeley-db=${pkgs.db}" ];
32 # We can also use a variable
33 preConfigure = ''
34 export BERKELEYDB_DIR=${pkgs.db.dev};
35 '';
36
37 postPatch = ''
38 substituteInPlace test3.py \
39 --replace-fail "from distutils.util import get_platform" "from sysconfig import get_platform" \
40 --replace-fail "sys.config[0:3]" "sys.implementation.cache_tag"
41 '';
42
43 checkPhase = ''
44 ${python.interpreter} test.py
45 '';
46
47 meta = with lib; {
48 description = "Python bindings for Oracle Berkeley DB";
49 homepage = "https://www.jcea.es/programacion/pybsddb.htm";
50 license = with licenses; [ agpl3Only ]; # License changed from bsd3 to agpl3 since 6.x
51 maintainers = [ ];
52 };
53}