about summary refs log tree commit diff
path: root/nixpkgs/pkgs/development/python-modules/django-otp/default.nix
blob: c1078160b6ebc923249cea1c0b48c6da94589410 (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
{ lib
, buildPythonPackage
, fetchFromGitHub
, hatchling
, django
, freezegun
, qrcode
, pytest
, python
}:

buildPythonPackage rec {
  pname = "django-otp";
  version = "1.3.0post1";
  pyproject = true;

  src = fetchFromGitHub {
    owner = "django-otp";
    repo = "django-otp";
    rev = "v${version}";
    hash = "sha256-Q8YTCYERyoAXenSiDabxuxaWiD6ZeJKKKgaR/Rg3y20=";
  };

  build-system = [
    hatchling
  ];

  dependencies = [
    django
    qrcode
  ];

  env.DJANGO_SETTINGS_MODUOLE = "test.test_project.settings";

  nativeCheckInputs = [
    freezegun
    pytest
  ];

  checkPhase = ''
    runHook preCheck

    export PYTHONPATH=$PYTHONPATH:test
    export DJANGO_SETTINGS_MODULE=test_project.settings
    ${python.interpreter} -m django test django_otp

    runHook postCheck
  '';

  pytestFlagsArray = [
    "src/django_otp/test.py"
  ];

  pythonImportsCheck = [
    "django_otp"
  ];

  meta = with lib; {
    homepage = "https://github.com/django-otp/django-otp";
    changelog = "https://github.com/django-otp/django-otp/blob/${src.rev}/CHANGES.rst";
    description = "Pluggable framework for adding two-factor authentication to Django using one-time passwords";
    license = licenses.bsd2;
    maintainers = with maintainers; [ ];
  };
}