depot/third_party/nixpkgs/pkgs/development/python-modules/flask-seasurf/default.nix
Default email bcb2f287e1 Project import generated by Copybara.
GitOrigin-RevId: d603719ec6e294f034936c0d0dc06f689d91b6c3
2024-06-20 20:27:18 +05:30

53 lines
1.3 KiB
Nix

{
lib,
fetchFromGitHub,
fetchpatch,
buildPythonPackage,
isPy3k,
flask,
mock,
unittestCheckHook,
}:
buildPythonPackage rec {
pname = "flask-seasurf";
version = "1.1.1";
disabled = !isPy3k;
src = fetchFromGitHub {
owner = "maxcountryman";
repo = "flask-seasurf";
rev = version;
hash = "sha256-L/ZUEqqHmsyXG5eShcITII36ttwQlZN5GBngo+GcCdw=";
};
patches = [
# Remove usage of deprecated flask._app_ctx_stack
(fetchpatch {
url = "https://github.com/maxcountryman/flask-seasurf/commit/9039764a4e44aeb1acb6ae7747deb438bee0826b.patch";
hash = "sha256-bVYzJN6MXzH3fNMknd2bh+04JlPJRkU0cLcWv+Rigqc=";
})
./0001-Fix-with-new-dependency-versions.patch
];
postPatch = ''
# Disable some tests, pytest is not supported
sed -i "s#\(\(test_header_set_on_post\|test_https_good_referer\|test_https_referer_check_disabled\)(self):\)#\1\n return#g" test_seasurf.py
'';
propagatedBuildInputs = [ flask ];
nativeCheckInputs = [
unittestCheckHook
mock
];
pythonImportsCheck = [ "flask_seasurf" ];
meta = with lib; {
description = "Flask extension for preventing cross-site request forgery";
homepage = "https://github.com/maxcountryman/flask-seasurf";
license = licenses.bsd3;
maintainers = with maintainers; [ zhaofengli ];
};
}