1{ lib
2, buildPythonPackage
3, fetchPypi
4, pytest
5, pytestrunner
6, six
7, html5lib
8, setuptools
9}:
10
11buildPythonPackage rec {
12 pname = "bleach";
13 version = "3.1.0";
14
15 src = fetchPypi {
16 inherit pname version;
17 sha256 = "3fdf7f77adcf649c9911387df51254b813185e32b2c6619f690b593a617e19fa";
18 };
19
20 checkInputs = [ pytest pytestrunner ];
21 propagatedBuildInputs = [ six html5lib setuptools ];
22
23 postPatch = ''
24 substituteInPlace setup.py --replace ",<3dev" ""
25 '';
26
27 # Disable a test
28 # https://github.com/mozilla/bleach/issues/467
29 checkPhase = ''
30 pytest -k "not test_only_text_is_cleaned"
31 '';
32
33 meta = {
34 description = "An easy, HTML5, whitelisting HTML sanitizer";
35 longDescription = ''
36 Bleach is an HTML sanitizing library that escapes or strips markup and
37 attributes based on a white list. Bleach can also linkify text safely,
38 applying filters that Django's urlize filter cannot, and optionally
39 setting rel attributes, even on links already in the text.
40
41 Bleach is intended for sanitizing text from untrusted sources. If you
42 find yourself jumping through hoops to allow your site administrators
43 to do lots of things, you're probably outside the use cases. Either
44 trust those users, or don't.
45 '';
46 homepage = https://github.com/mozilla/bleach;
47 downloadPage = https://github.com/mozilla/bleach/releases;
48 license = lib.licenses.asl20;
49 maintainers = with lib.maintainers; [ prikhi ];
50 };
51}