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] 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";