2021-06-21 12:12:42 +00:00
|
|
|
{ stdenv
|
|
|
|
, lib
|
|
|
|
, buildPythonPackage
|
|
|
|
, pythonOlder
|
|
|
|
, isPyPy
|
|
|
|
, fetchPypi
|
|
|
|
, postgresql
|
|
|
|
, openssl
|
|
|
|
}:
|
2018-09-07 10:13:15 +00:00
|
|
|
|
|
|
|
buildPythonPackage rec {
|
|
|
|
pname = "psycopg2";
|
2021-06-18 21:47:31 +00:00
|
|
|
version = "2.9.1";
|
2018-09-07 10:13:15 +00:00
|
|
|
|
2020-11-18 08:58:42 +00:00
|
|
|
# Extension modules don't work well with PyPy. Use psycopg2cffi instead.
|
|
|
|
# c.f. https://github.com/NixOS/nixpkgs/pull/104151#issuecomment-729750892
|
2021-06-21 12:12:42 +00:00
|
|
|
disabled = pythonOlder "3.6" || isPyPy;
|
2018-09-07 10:13:15 +00:00
|
|
|
|
|
|
|
src = fetchPypi {
|
|
|
|
inherit pname version;
|
2021-06-21 12:12:42 +00:00
|
|
|
sha256 = "0z0v2d5gpgy0wf2ypqxv955c9k44yszd7r20km5s79yhy6k06lyy";
|
2018-09-07 10:13:15 +00:00
|
|
|
};
|
|
|
|
|
2021-06-21 12:12:42 +00:00
|
|
|
nativeBuildInputs = [
|
|
|
|
postgresql
|
|
|
|
];
|
2018-09-07 10:13:15 +00:00
|
|
|
|
2021-06-21 12:12:42 +00:00
|
|
|
buildInputs = lib.optionals stdenv.isDarwin [
|
|
|
|
openssl
|
|
|
|
];
|
|
|
|
|
|
|
|
# requires setting up a postgresql database
|
2018-09-07 10:13:15 +00:00
|
|
|
doCheck = false;
|
|
|
|
|
|
|
|
meta = with lib; {
|
|
|
|
description = "PostgreSQL database adapter for the Python programming language";
|
2021-06-21 12:12:42 +00:00
|
|
|
homepage = "https://www.psycopg.org";
|
|
|
|
license = with licenses; [ lgpl3 zpl20 ];
|
2018-09-07 10:13:15 +00:00
|
|
|
};
|
|
|
|
}
|