python312Packages.testing-postgresql: modernize

This commit is contained in:
Peder Bergebakken Sundt 2024-08-24 18:50:29 +02:00
parent 42c5dd113b
commit 9990671fa4

View File

@ -2,6 +2,7 @@
lib,
buildPythonPackage,
fetchFromGitHub,
setuptools,
pg8000,
postgresql,
psycopg2,
@ -15,7 +16,7 @@ buildPythonPackage rec {
pname = "testing-postgresql";
# Version 1.3.0 isn't working so let's use the latest commit from GitHub
version = "unstable-2017-10-31";
format = "setuptools";
pyproject = true;
disabled = pythonOlder "3.7";
@ -26,7 +27,9 @@ buildPythonPackage rec {
hash = "sha256-A4tahAaa98X66ZYa3QxIQDZkwAwVB6ZDRObEhkbUWKs=";
};
propagatedBuildInputs = [
build-system = [ setuptools ];
dependencies = [
testing-common-database
pg8000
];
@ -40,12 +43,14 @@ buildPythonPackage rec {
# Add PostgreSQL to search path
prePatch = ''
substituteInPlace src/testing/postgresql.py \
--replace "/usr/local/pgsql" "${postgresql}"
--replace-fail "/usr/local/pgsql" "${postgresql}"
'';
pythonRelaxDeps = [ "pg8000" ];
postPatch = ''
substituteInPlace setup.py \
--replace "pg8000 >= 1.10" "pg8000"
--replace-fail "pg8000 >= 1.10" "pg8000"
substituteInPlace tests/test_postgresql.py \
--replace-fail "self.assertRegexpMatches" "self.assertRegex"
'';