about summary refs log tree commit diff
path: root/pkgs/development/python-modules/psycopg2cffi/default.nix
blob: f791f953d3f0a4e5c7df05e396f9a68ed37ca79e (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
{ buildPythonPackage
, cffi
, fetchFromGitHub
, lib
, postgresql
, postgresqlTestHook
, pytestCheckHook
, six
}:

buildPythonPackage rec {
  pname = "psycopg2cffi";
  version = "2.8.1";
  format = "setuptools";

  # NB: This is a fork.
  # The original repo exists at https://github.com/chtd/psycopg2cffi, however
  # this is mostly unmaintained and does not build for PyPy. Given that the
  # whole point of this cffi alternative to psycopg2 is to use it with PyPy, I
  # chose to use a working fork instead, which was linked in the relevant issue:
  # https://github.com/chtd/psycopg2cffi/issues/113#issuecomment-730548574
  #
  # If/when these changes get merged back upstream we should revert to using the
  # original source as opposed to the fork.
  src = fetchFromGitHub {
    owner = "Omegapol";
    repo = pname;
    rev = "c202b25cd861d5e8f0f55c329764ff1da9f020c0";
    sha256 = "09hsnjkix1c0vlhmfvrp8pchpnz2ya4xrchyq15czj527nx2dmy2";
  };

  nativeBuildInputs = [ postgresql ];

  propagatedBuildInputs = [ six cffi ];

  nativeCheckInputs = [ postgresqlTestHook pytestCheckHook ];

  disabledTests = [
    # AssertionError: '{}' != []
    "testEmptyArray"
  ];

  env = {
    PGDATABASE = "psycopg2_test";
  };

  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 ];
  };
}