2024-06-05 15:53:02 +00:00
|
|
|
{
|
|
|
|
lib,
|
|
|
|
fetchFromGitHub,
|
|
|
|
fetchpatch,
|
|
|
|
buildPythonPackage,
|
|
|
|
isPy3k,
|
|
|
|
flask,
|
|
|
|
mock,
|
|
|
|
unittestCheckHook,
|
|
|
|
}:
|
2021-03-09 03:18:52 +00:00
|
|
|
|
|
|
|
buildPythonPackage rec {
|
2024-04-21 15:54:59 +00:00
|
|
|
pname = "flask-seasurf";
|
2022-04-27 09:35:20 +00:00
|
|
|
version = "1.1.1";
|
2021-03-09 03:18:52 +00:00
|
|
|
disabled = !isPy3k;
|
|
|
|
|
|
|
|
src = fetchFromGitHub {
|
|
|
|
owner = "maxcountryman";
|
|
|
|
repo = "flask-seasurf";
|
|
|
|
rev = version;
|
2023-03-15 16:39:30 +00:00
|
|
|
hash = "sha256-L/ZUEqqHmsyXG5eShcITII36ttwQlZN5GBngo+GcCdw=";
|
2021-03-09 03:18:52 +00:00
|
|
|
};
|
|
|
|
|
2024-01-02 11:29:13 +00:00
|
|
|
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
|
|
|
|
'';
|
|
|
|
|
2021-03-09 03:18:52 +00:00
|
|
|
propagatedBuildInputs = [ flask ];
|
|
|
|
|
2023-02-02 18:25:31 +00:00
|
|
|
nativeCheckInputs = [
|
2022-09-09 14:08:57 +00:00
|
|
|
unittestCheckHook
|
2022-04-27 09:35:20 +00:00
|
|
|
mock
|
|
|
|
];
|
|
|
|
|
2021-03-09 03:18:52 +00:00
|
|
|
pythonImportsCheck = [ "flask_seasurf" ];
|
|
|
|
|
|
|
|
meta = with lib; {
|
2024-06-20 14:57:18 +00:00
|
|
|
description = "Flask extension for preventing cross-site request forgery";
|
2021-03-09 03:18:52 +00:00
|
|
|
homepage = "https://github.com/maxcountryman/flask-seasurf";
|
|
|
|
license = licenses.bsd3;
|
|
|
|
maintainers = with maintainers; [ zhaofengli ];
|
|
|
|
};
|
|
|
|
}
|