summaryrefslogtreecommitdiff
path: root/pkgs/development/python-modules/django-agnocomplete/default.nix
blob: 34551d79d02872a301ad1d1cf1d23ad0d57e9191 (plain)
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
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
{
  lib,
  django,
  buildPythonPackage,
  fetchFromGitHub,
  setuptools,
  setuptools-scm,
  requests,
  six,
  pytestCheckHook,
  pytest-cov-stub,
  pytest-django,
  mock,
  pyyaml,
}:
buildPythonPackage rec {
  pname = "django-agnocomplete";
  version = "2.2.0";
  pyproject = true;

  src = fetchFromGitHub {
    owner = "peopledoc";
    repo = "django-agnocomplete";
    rev = version;
    hash = "sha256-SDuLJM/ZvROkBOSbaVi6FMDRcR5Um4UrdPSq1ZMrlXM=";
  };

  build-system = [
    setuptools
    setuptools-scm
  ];

  dependencies = [
    django
    requests
    six
  ];

  pythonImportsCheck = [
    "agnocomplete"
  ];

  nativeCheckInputs = [
    pytestCheckHook
    pytest-cov-stub
    pytest-django
    mock
    pyyaml
  ];

  postPatch = ''
    # 1. The "default.html" templates for forms and formsets will be removed.
    #    These were proxies to the equivalent "table.html" templates, but the new
    #    "div.html" templates will be the default from Django 5.0.
    #    https://docs.djangoproject.com/en/4.2/releases/4.1/
    #    https://docs.djangoproject.com/en/4.2/ref/forms/api/#as-div
    #
    # 2. assertQuerysetEqual() is deprecated in favor of assertQuerySetEqual()
    substituteInPlace demo/tests/test_fields.py \
      --replace-fail '"{}".format(form)' 'form.as_div()' \
      --replace-fail "assertQuerysetEqual" "assertQuerySetEqual"
  '';

  disabledTests = [
    # Exception message does not match for abstract class test, but the result
    # should be the same: can't instantiate abstract class
    "test_AgnocompleteBase"
    "test_AgnocompleteModel"
  ];

  __darwinAllowLocalNetworking = true;

  meta = {
    description = "front-end agnostic toolbox for autocompletion fields";
    homepage = "https://github.com/peopledoc/django-agnocomplete";
    changelog = "https://github.com/peopledoc/django-agnocomplete/blob/${src.rev}/CHANGELOG.rst";
    license = lib.licenses.mit;
    maintainers = with lib.maintainers; [
      LorenzBischof
      jcollie
    ];
  };
}