2021-06-28 23:13:55 +00:00
|
|
|
{ stdenv
|
|
|
|
, lib
|
|
|
|
, buildPythonPackage
|
|
|
|
, pythonOlder
|
|
|
|
, isPyPy
|
|
|
|
, fetchPypi
|
|
|
|
, postgresql
|
|
|
|
, openssl
|
|
|
|
}:
|
2020-04-24 23:36:52 +00:00
|
|
|
|
|
|
|
buildPythonPackage rec {
|
|
|
|
pname = "psycopg2";
|
2021-12-26 17:43:05 +00:00
|
|
|
version = "2.9.2";
|
2020-04-24 23:36:52 +00:00
|
|
|
|
2020-11-21 19:51:51 +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-28 23:13:55 +00:00
|
|
|
disabled = pythonOlder "3.6" || isPyPy;
|
2020-04-24 23:36:52 +00:00
|
|
|
|
|
|
|
src = fetchPypi {
|
|
|
|
inherit pname version;
|
2021-12-26 17:43:05 +00:00
|
|
|
sha256 = "a84da9fa891848e0270e8e04dcca073bc9046441eeb47069f5c0e36783debbea";
|
2020-04-24 23:36:52 +00:00
|
|
|
};
|
|
|
|
|
2021-06-28 23:13:55 +00:00
|
|
|
nativeBuildInputs = [
|
|
|
|
postgresql
|
|
|
|
];
|
2020-04-24 23:36:52 +00:00
|
|
|
|
2021-06-28 23:13:55 +00:00
|
|
|
buildInputs = lib.optionals stdenv.isDarwin [
|
|
|
|
openssl
|
|
|
|
];
|
|
|
|
|
|
|
|
# requires setting up a postgresql database
|
2020-04-24 23:36:52 +00:00
|
|
|
doCheck = false;
|
|
|
|
|
|
|
|
meta = with lib; {
|
|
|
|
description = "PostgreSQL database adapter for the Python programming language";
|
2021-06-28 23:13:55 +00:00
|
|
|
homepage = "https://www.psycopg.org";
|
|
|
|
license = with licenses; [ lgpl3 zpl20 ];
|
2020-04-24 23:36:52 +00:00
|
|
|
};
|
|
|
|
}
|