1{ buildPythonPackage, cffi, fetchFromGitHub, lib, postgresql, pytestCheckHook, six }:
2
3buildPythonPackage rec {
4 pname = "psycopg2cffi";
5 version = "2.8.1";
6
7 # NB: This is a fork.
8 # The original repo exists at https://github.com/chtd/psycopg2cffi, however
9 # this is mostly unmaintained and does not build for PyPy. Given that the
10 # whole point of this cffi alternative to psycopg2 is to use it with PyPy, I
11 # chose to use a working fork instead, which was linked in the relevant issue:
12 # https://github.com/chtd/psycopg2cffi/issues/113#issuecomment-730548574
13 #
14 # If/when these changes get merged back upstream we should revert to using the
15 # original source as opposed to the fork.
16 src = fetchFromGitHub {
17 owner = "Omegapol";
18 repo = pname;
19 rev = "c202b25cd861d5e8f0f55c329764ff1da9f020c0";
20 sha256 = "09hsnjkix1c0vlhmfvrp8pchpnz2ya4xrchyq15czj527nx2dmy2";
21 };
22
23 nativeBuildInputs = [ postgresql ];
24 propagatedBuildInputs = [ six cffi ];
25 nativeCheckInputs = [ pytestCheckHook ];
26
27 # NB: The tests need a postgres instance running to test against, and so we
28 # disable them.
29 doCheck = false;
30
31 pythonImportsCheck = [ "psycopg2cffi" ];
32
33 meta = with lib; {
34 description = "An implementation of the psycopg2 module using cffi";
35 homepage = "https://pypi.org/project/psycopg2cffi/";
36 license = with licenses; [ lgpl3Plus ];
37 maintainers = with maintainers; [ lovesegfault ];
38 };
39}