From c697f20356174bfa7dfb844d1dabb058387156e8 Mon Sep 17 00:00:00 2001 From: kenshin <14914796+AkechiShiro@users.noreply.github.com> Date: Sat, 25 May 2024 17:17:40 +0200 Subject: [PATCH 1/4] python312Packages.berkeleydb: init at 18.1.8 * Add env fix from tomaSajt * nixformat * better format for imports * remove unused import --- .../python-modules/berkeleydb/default.nix | 38 +++++++++++++++++++ pkgs/top-level/python-packages.nix | 2 + 2 files changed, 40 insertions(+) create mode 100644 pkgs/development/python-modules/berkeleydb/default.nix diff --git a/pkgs/development/python-modules/berkeleydb/default.nix b/pkgs/development/python-modules/berkeleydb/default.nix new file mode 100644 index 000000000000..514a9b0c689a --- /dev/null +++ b/pkgs/development/python-modules/berkeleydb/default.nix @@ -0,0 +1,38 @@ +{ + lib, + buildPythonPackage, + fetchPypi, + setuptools, + pkgs, + python, +}: + +buildPythonPackage rec { + pname = "berkeleydb"; + version = "18.1.8"; + pyproject = true; + + src = fetchPypi { + inherit pname version; + hash = "sha256-4YMaeQv9hVdA5cEvlS8Z9kbCaYBs/DYnda/Zh4zzJVc="; + }; + + build-system = [ setuptools ]; + + checkPhase = '' + ${python.interpreter} test.py + ''; + + # See: https://github.com/NixOS/nixpkgs/pull/311198/files#r1597746759 + env = { + BERKELEYDB_INCDIR = "${lib.getDev pkgs.db}/include"; + BERKELEYDB_LIBDIR = "${lib.getLib pkgs.db}/lib"; + }; + + meta = with lib; { + description = "Python bindings for Oracle Berkeley DB"; + homepage = "https://www.jcea.es/programacion/pybsddb.htm"; + license = with licenses; [ bsd3 ]; + maintainers = [ ]; + }; +} diff --git a/pkgs/top-level/python-packages.nix b/pkgs/top-level/python-packages.nix index 483cb05e6996..f0a547b747e4 100644 --- a/pkgs/top-level/python-packages.nix +++ b/pkgs/top-level/python-packages.nix @@ -1503,6 +1503,8 @@ self: super: with self; { bentoml = callPackage ../development/python-modules/bentoml { }; + berkeleydb = callPackage ../development/python-modules/berkeleydb { }; + bespon = callPackage ../development/python-modules/bespon { }; betacode = callPackage ../development/python-modules/betacode { }; From 729f34a0c8df601db5090f0d9f134433bfe9d3f8 Mon Sep 17 00:00:00 2001 From: kenshin <14914796+AkechiShiro@users.noreply.github.com> Date: Sat, 25 May 2024 17:21:46 +0200 Subject: [PATCH 2/4] exaile: replace bsddb3 with berkeleydb Prepare for Python 3.12 compatibility as bsddb3 is not officially compatible with Python 3.10+ and Python 3.12 breaks bsddb3 tests due to distutils being deprecated. --- pkgs/applications/audio/exaile/default.nix | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pkgs/applications/audio/exaile/default.nix b/pkgs/applications/audio/exaile/default.nix index 036bcc70ddd0..4f49564898a9 100644 --- a/pkgs/applications/audio/exaile/default.nix +++ b/pkgs/applications/audio/exaile/default.nix @@ -51,7 +51,7 @@ stdenv.mkDerivation rec { gst-plugins-ugly gst-libav ]) ++ (with python3.pkgs; [ - bsddb3 + berkeleydb dbus-python mutagen pygobject3 From 92fd43bd759a6f5a504bf5e90e6fd5e9dbde25ed Mon Sep 17 00:00:00 2001 From: kenshin <14914796+AkechiShiro@users.noreply.github.com> Date: Sat, 25 May 2024 17:36:00 +0200 Subject: [PATCH 3/4] gramps: replace bsddb3 with berkeleydb Prepare for Python 3.12 compatibility as bsddb3 is not officially compatible with Python 3.10+ and Python 3.12 breaks bsddb3 tests due to distutils being deprecated --- pkgs/applications/misc/gramps/default.nix | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pkgs/applications/misc/gramps/default.nix b/pkgs/applications/misc/gramps/default.nix index 7feab95b003a..5ecab79226c8 100644 --- a/pkgs/applications/misc/gramps/default.nix +++ b/pkgs/applications/misc/gramps/default.nix @@ -69,7 +69,7 @@ buildPythonApplication rec { ; propagatedBuildInputs = with pythonPackages; [ - bsddb3 + berkeleydb pyicu pygobject3 pycairo From 10e9deb7982f659c05bb0304ec09ee862e6395b1 Mon Sep 17 00:00:00 2001 From: kenshin <14914796+AkechiShiro@users.noreply.github.com> Date: Sat, 25 May 2024 21:07:08 +0200 Subject: [PATCH 4/4] python39Packages.bsddb3: disable on Python 3.10+, remove distutils usage --- .../python-modules/bsddb3/default.nix | 22 +++++++++++++------ 1 file changed, 15 insertions(+), 7 deletions(-) diff --git a/pkgs/development/python-modules/bsddb3/default.nix b/pkgs/development/python-modules/bsddb3/default.nix index fbf29c4f7eac..af25971df03b 100644 --- a/pkgs/development/python-modules/bsddb3/default.nix +++ b/pkgs/development/python-modules/bsddb3/default.nix @@ -1,11 +1,11 @@ { lib, buildPythonPackage, + pythonAtLeast, + python, fetchPypi, setuptools, pkgs, - python, - pythonOlder, }: buildPythonPackage rec { @@ -22,11 +22,9 @@ buildPythonPackage rec { buildInputs = [ pkgs.db ]; - doCheck = pythonOlder "3.12"; # distutils usage - - checkPhase = '' - ${python.interpreter} test.py - ''; + # See : https://github.com/NixOS/nixpkgs/pull/311198#discussion_r1599257522 + # More details here : https://www.jcea.es/programacion/pybsddb.htm + disabled = pythonAtLeast "3.10"; # Path to database need to be set. # Somehow the setup.py flag is not propagated. @@ -36,6 +34,16 @@ buildPythonPackage rec { export BERKELEYDB_DIR=${pkgs.db.dev}; ''; + postPatch = '' + substituteInPlace test3.py \ + --replace-fail "from distutils.util import get_platform" "from sysconfig import get_platform" \ + --replace-fail "sys.config[0:3]" "sys.implementation.cache_tag" + ''; + + checkPhase = '' + ${python.interpreter} test.py + ''; + meta = with lib; { description = "Python bindings for Oracle Berkeley DB"; homepage = "https://www.jcea.es/programacion/pybsddb.htm";