2021-06-14 07:14:40 +00:00
|
|
|
{
|
|
|
|
lib,
|
|
|
|
buildPythonPackage,
|
|
|
|
fetchFromGitHub,
|
2023-06-30 07:35:22 +00:00
|
|
|
hatchling,
|
2021-06-14 07:14:40 +00:00
|
|
|
lxml,
|
2024-07-16 14:36:15 +00:00
|
|
|
lxml-html-clean,
|
2021-06-14 07:14:40 +00:00
|
|
|
beautifulsoup4,
|
|
|
|
pytestCheckHook,
|
2023-06-30 07:33:17 +00:00
|
|
|
pythonOlder,
|
2021-06-14 07:14:40 +00:00
|
|
|
}:
|
2020-06-21 00:50:43 +00:00
|
|
|
|
|
|
|
buildPythonPackage rec {
|
|
|
|
pname = "html-sanitizer";
|
2024-07-22 18:50:48 +00:00
|
|
|
version = "2.4.4";
|
2024-03-10 20:34:27 +00:00
|
|
|
pyproject = true;
|
2023-06-30 07:33:17 +00:00
|
|
|
|
|
|
|
disabled = pythonOlder "3.7";
|
2020-06-21 00:50:43 +00:00
|
|
|
|
|
|
|
src = fetchFromGitHub {
|
|
|
|
owner = "matthiask";
|
2024-03-10 20:34:27 +00:00
|
|
|
repo = "html-sanitizer";
|
2023-06-30 07:32:25 +00:00
|
|
|
rev = "refs/tags/${version}";
|
2024-07-22 18:50:48 +00:00
|
|
|
hash = "sha256-6OWFLsuefeDzQ1uHnLmboKDgrbY/xJCwqsSQlDaJlRs=";
|
2020-06-21 00:50:43 +00:00
|
|
|
};
|
|
|
|
|
2023-06-30 07:35:22 +00:00
|
|
|
nativeBuildInputs = [ hatchling ];
|
|
|
|
|
2021-06-14 07:14:40 +00:00
|
|
|
propagatedBuildInputs = [
|
|
|
|
lxml
|
2024-07-16 14:36:15 +00:00
|
|
|
lxml-html-clean
|
2021-06-14 07:14:40 +00:00
|
|
|
beautifulsoup4
|
|
|
|
];
|
|
|
|
|
2023-01-21 12:00:00 +00:00
|
|
|
nativeCheckInputs = [ pytestCheckHook ];
|
2021-06-14 07:14:40 +00:00
|
|
|
|
2022-01-08 11:10:31 +00:00
|
|
|
pytestFlagsArray = [ "html_sanitizer/tests.py" ];
|
|
|
|
|
|
|
|
disabledTests = [
|
2022-04-19 08:00:02 +00:00
|
|
|
# Tests are sensitive to output
|
2022-01-08 11:10:31 +00:00
|
|
|
"test_billion_laughs"
|
2022-04-19 08:00:02 +00:00
|
|
|
"test_10_broken_html"
|
2022-01-08 11:10:31 +00:00
|
|
|
];
|
2021-06-14 07:14:40 +00:00
|
|
|
|
2022-01-08 11:10:31 +00:00
|
|
|
pythonImportsCheck = [ "html_sanitizer" ];
|
2020-06-21 00:50:43 +00:00
|
|
|
|
|
|
|
meta = with lib; {
|
2021-06-14 07:14:40 +00:00
|
|
|
description = "Allowlist-based and very opinionated HTML sanitizer";
|
2020-06-21 00:50:43 +00:00
|
|
|
homepage = "https://github.com/matthiask/html-sanitizer";
|
2023-06-30 07:32:25 +00:00
|
|
|
changelog = "https://github.com/matthiask/html-sanitizer/blob/${version}/CHANGELOG.rst";
|
2021-06-14 07:14:40 +00:00
|
|
|
license = with licenses; [ bsd3 ];
|
|
|
|
maintainers = with maintainers; [ fab ];
|
2020-06-21 00:50:43 +00:00
|
|
|
};
|
|
|
|
}
|