about summary refs log tree commit diff
path: root/nixpkgs/pkgs/development/python-modules/django-auditlog/default.nix
blob: fa52f1b3d59cced4d5f49e4b9afbc56df6113e95 (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
56
57
58
59
60
61
62
63
64
65
66
67
{ lib
, buildPythonPackage
, fetchFromGitHub
, setuptools
, setuptools-scm
, django
, python-dateutil
, freezegun
, psycopg2
, postgresql
, postgresqlTestHook
, python
}:

buildPythonPackage rec {
  pname = "django-auditlog";
  version = "2.2.2";
  pyproject = true;

  src = fetchFromGitHub {
    owner = "jazzband";
    repo = pname;
    rev = "v${version}";
    hash = "sha256-QHSGqtpkOgltAg+RlG/Ik3DfEjtSWt45sqlD+Zw4Bh0=";
  };

  env.SETUPTOOLS_SCM_PRETEND_VERSION = version;

  nativeBuildInputs = [
    setuptools
    setuptools-scm
  ];

  propagatedBuildInputs = [
    django
    python-dateutil
  ];

  nativeCheckInputs = [
    freezegun
    psycopg2
    postgresql
    postgresqlTestHook
  ];

  postgresqlTestUserOptions = "LOGIN SUPERUSER";

  checkPhase = ''
    runHook preCheck

    TEST_DB_USER=$PGUSER \
    TEST_DB_HOST=$PGHOST \
    ${python.interpreter} runtests.py

    runHook postCheck
  '';

  pythonImportsCheck = [ "auditlog" ];

  meta = with lib; {
    changelog = "https://github.com/jazzband/django-auditlog/blob/v${version}/CHANGELOG.md";
    description = "A Django app that keeps a log of changes made to an object";
    downloadPage = "https://github.com/jazzband/django-auditlog";
    license = licenses.mit;
    maintainers = with maintainers; [ leona ];
  };
}