1{ lib
2, buildPythonPackage
3, fetchFromGitHub
4, fetchpatch
5, flask
6, python
7}:
8
9buildPythonPackage rec {
10 pname = "flask-basicauth";
11 version = "0.2.0";
12
13 src = fetchFromGitHub {
14 owner = "jpvanhal";
15 repo = pname;
16 rev = "v${version}";
17 hash = "sha256-han0OjMI1XmuWKHGVpk+xZB+/+cpV1I+659zOG3hcPY=";
18 };
19
20 patches = [
21 (fetchpatch {
22 # The unit tests fail due to an invalid import:
23 # from flask.ext.basicauth import BasicAuth
24 #
25 # This patch replaces it with the correct import:
26 # from flask_basicauth import BasicAuth
27 #
28 # The patch uses the changes from this pull request,
29 # and therefore can be removed once this pull request
30 # has been merged:
31 # https://github.com/jpvanhal/flask-basicauth/pull/29
32 name = "fix-test-flask-ext-imports.patch";
33 url = "https://github.com/jpvanhal/flask-basicauth/commit/23f57dc1c3d85ea6fc7f468e8d8c6f19348a0a81.patch";
34 hash = "sha256-njUYjO0TRe3vr5D0XjIfCNcsFlShbGxtFV/DJerAKDE=";
35 })
36 ];
37
38 propagatedBuildInputs = [ flask ];
39
40 checkPhase = ''
41 runHook preCheck
42 ${python.interpreter} -m unittest discover
43 runHook postCheck
44 '';
45
46 pythonImportsCheck = [ "flask_basicauth" ];
47
48 meta = with lib; {
49 homepage = "https://github.com/jpvanhal/flask-basicauth";
50 description = "HTTP basic access authentication for Flask";
51 license = licenses.mit;
52 maintainers = with maintainers; [ wesnel ];
53 };
54}