about summary refs log tree commit diff
path: root/nixpkgs/pkgs/development/python-modules/flask-basicauth/default.nix
blob: 97a214744457bf594463ea5f6d5eda53a3bf869a (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
{ lib
, buildPythonPackage
, fetchFromGitHub
, fetchpatch
, flask
, python
}:

buildPythonPackage rec {
  pname = "flask-basicauth";
  version = "0.2.0";
  format = "setuptools";

  src = fetchFromGitHub {
    owner = "jpvanhal";
    repo = pname;
    rev = "v${version}";
    hash = "sha256-han0OjMI1XmuWKHGVpk+xZB+/+cpV1I+659zOG3hcPY=";
  };

  patches = [
    (fetchpatch {
      # The unit tests fail due to an invalid import:
      #   from flask.ext.basicauth import BasicAuth
      #
      # This patch replaces it with the correct import:
      #   from flask_basicauth import BasicAuth
      #
      # The patch uses the changes from this pull request,
      # and therefore can be removed once this pull request
      # has been merged:
      #   https://github.com/jpvanhal/flask-basicauth/pull/29
      name = "fix-test-flask-ext-imports.patch";
      url = "https://github.com/jpvanhal/flask-basicauth/commit/23f57dc1c3d85ea6fc7f468e8d8c6f19348a0a81.patch";
      hash = "sha256-njUYjO0TRe3vr5D0XjIfCNcsFlShbGxtFV/DJerAKDE=";
    })
  ];

  propagatedBuildInputs = [ flask ];

  checkPhase = ''
    runHook preCheck
    ${python.interpreter} -m unittest discover
    runHook postCheck
  '';

  pythonImportsCheck = [ "flask_basicauth" ];

  meta = with lib; {
    homepage = "https://github.com/jpvanhal/flask-basicauth";
    description = "HTTP basic access authentication for Flask";
    license = licenses.mit;
    maintainers = with maintainers; [ wesnel ];
  };
}