2024-02-29 20:09:43 +00:00
|
|
|
{ buildPythonPackage
|
|
|
|
, cffi
|
|
|
|
, fetchFromGitHub
|
|
|
|
, lib
|
|
|
|
, postgresql
|
|
|
|
, postgresqlTestHook
|
|
|
|
, pytestCheckHook
|
2024-05-15 15:35:15 +00:00
|
|
|
, setuptools
|
2024-02-29 20:09:43 +00:00
|
|
|
, six
|
2024-05-15 15:35:15 +00:00
|
|
|
, stdenv
|
2024-02-29 20:09:43 +00:00
|
|
|
}:
|
2020-11-24 20:58:05 +00:00
|
|
|
|
|
|
|
buildPythonPackage rec {
|
|
|
|
pname = "psycopg2cffi";
|
2024-05-15 15:35:15 +00:00
|
|
|
version = "2.9.0";
|
|
|
|
pyproject = true;
|
|
|
|
|
2020-11-24 20:58:05 +00:00
|
|
|
src = fetchFromGitHub {
|
2024-05-15 15:35:15 +00:00
|
|
|
owner = "chtd";
|
|
|
|
repo = "psycopg2cffi";
|
|
|
|
rev = "refs/tags/${version}";
|
|
|
|
hash = "sha256-9r5MYxw9cvdbLVj8StmMmn0AKQepOpCc7TIBGXZGWe4=";
|
2020-11-24 20:58:05 +00:00
|
|
|
};
|
|
|
|
|
2024-05-15 15:35:15 +00:00
|
|
|
postPatch = ''
|
|
|
|
substituteInPlace psycopg2cffi/_impl/_build_libpq.py \
|
|
|
|
--replace-fail "from distutils import sysconfig" "import sysconfig" \
|
|
|
|
--replace-fail "sysconfig.get_python_inc()" "sysconfig.get_path('include')"
|
|
|
|
'';
|
|
|
|
|
|
|
|
build-system = [
|
|
|
|
postgresql
|
|
|
|
setuptools
|
|
|
|
];
|
|
|
|
|
|
|
|
dependencies = [
|
|
|
|
cffi
|
|
|
|
six
|
|
|
|
];
|
2024-02-29 20:09:43 +00:00
|
|
|
|
2024-05-15 15:35:15 +00:00
|
|
|
# FATAL: could not create shared memory segment: Operation not permitted
|
|
|
|
doCheck = !stdenv.isDarwin;
|
2020-11-24 20:58:05 +00:00
|
|
|
|
2024-05-15 15:35:15 +00:00
|
|
|
nativeCheckInputs = [
|
|
|
|
postgresqlTestHook
|
|
|
|
pytestCheckHook
|
|
|
|
];
|
2024-02-29 20:09:43 +00:00
|
|
|
|
|
|
|
disabledTests = [
|
|
|
|
# AssertionError: '{}' != []
|
|
|
|
"testEmptyArray"
|
|
|
|
];
|
|
|
|
|
|
|
|
env = {
|
|
|
|
PGDATABASE = "psycopg2_test";
|
|
|
|
};
|
2020-11-24 20:58:05 +00:00
|
|
|
|
|
|
|
pythonImportsCheck = [ "psycopg2cffi" ];
|
|
|
|
|
|
|
|
meta = with lib; {
|
|
|
|
description = "An implementation of the psycopg2 module using cffi";
|
|
|
|
homepage = "https://pypi.org/project/psycopg2cffi/";
|
|
|
|
license = with licenses; [ lgpl3Plus ];
|
|
|
|
maintainers = with maintainers; [ lovesegfault ];
|
|
|
|
};
|
|
|
|
}
|