diff --git a/pkgs/development/python-modules/flask-basicauth/default.nix b/pkgs/development/python-modules/flask-basicauth/default.nix new file mode 100644 index 000000000000..7554c4cdca9c --- /dev/null +++ b/pkgs/development/python-modules/flask-basicauth/default.nix @@ -0,0 +1,54 @@ +{ lib +, buildPythonPackage +, fetchFromGitHub +, fetchpatch +, flask +, python +}: + +buildPythonPackage rec { + pname = "flask-basicauth"; + version = "0.2.0"; + + src = fetchFromGitHub { + owner = "jpvanhal"; + repo = pname; + rev = "v${version}"; + sha256 = "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"; + sha256 = "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 ]; + }; +} diff --git a/pkgs/top-level/python-packages.nix b/pkgs/top-level/python-packages.nix index 6e3a726e4781..c623e8dff792 100644 --- a/pkgs/top-level/python-packages.nix +++ b/pkgs/top-level/python-packages.nix @@ -3280,6 +3280,8 @@ in { flask-babelex = callPackage ../development/python-modules/flask-babelex { }; + flask-basicauth = callPackage ../development/python-modules/flask-basicauth { }; + flask-bcrypt = callPackage ../development/python-modules/flask-bcrypt { }; flask-bootstrap = callPackage ../development/python-modules/flask-bootstrap { };