1{
2 lib,
3 buildPythonPackage,
4 fetchFromGitHub,
5 setuptools,
6 lxml,
7 unittestCheckHook,
8}:
9
10buildPythonPackage rec {
11 pname = "lxml-html-clean";
12 version = "0.4.2";
13 pyproject = true;
14
15 src = fetchFromGitHub {
16 owner = "fedora-python";
17 repo = "lxml_html_clean";
18 tag = version;
19 hash = "sha256-KGUFRbcaeDcX2jyoyyZMZsVTbN+h8uy+ugcritkZe38=";
20 };
21
22 # Disable failing snapshot tests (AssertionError)
23 # https://github.com/fedora-python/lxml_html_clean/issues/24
24 # As this derivation must use unittestCheckHook, we cannot use disabledTests
25 postPatch = ''
26 substituteInPlace tests/test_clean.py \
27 --replace-fail \
28 "test_host_whitelist_valid" \
29 "DISABLED_test_host_whitelist_valid" \
30 --replace-fail \
31 "test_host_whitelist_invalid" \
32 "DISABLED_test_host_whitelist_invalid" \
33 --replace-fail \
34 "test_host_whitelist_sneaky_userinfo" \
35 "DISABLED_test_host_whitelist_sneaky_userinfo"
36 '';
37
38 build-system = [ setuptools ];
39
40 dependencies = [ lxml ];
41
42 nativeCheckInputs = [ unittestCheckHook ];
43
44 pythonImportsCheck = [ "lxml_html_clean" ];
45
46 meta = {
47 description = "Separate project for HTML cleaning functionalities copied from lxml.html.clean";
48 homepage = "https://github.com/fedora-python/lxml_html_clean/";
49 changelog = "https://github.com/fedora-python/lxml_html_clean/blob/${version}/CHANGES.rst";
50 license = lib.licenses.bsd3;
51 maintainers = with lib.maintainers; [ fab ];
52 };
53}