nixpkgs mirror (for testing)
github.com/NixOS/nixpkgs
nix
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 network tests
28 checkPhase = ''
29 pytest -k "not protocols"
30 '';
31
32 meta = {
33 description = "An easy, HTML5, whitelisting HTML sanitizer";
34 longDescription = ''
35 Bleach is an HTML sanitizing library that escapes or strips markup and
36 attributes based on a white list. Bleach can also linkify text safely,
37 applying filters that Django's urlize filter cannot, and optionally
38 setting rel attributes, even on links already in the text.
39
40 Bleach is intended for sanitizing text from untrusted sources. If you
41 find yourself jumping through hoops to allow your site administrators
42 to do lots of things, you're probably outside the use cases. Either
43 trust those users, or don't.
44 '';
45 homepage = https://github.com/mozilla/bleach;
46 downloadPage = https://github.com/mozilla/bleach/releases;
47 license = lib.licenses.asl20;
48 maintainers = with lib.maintainers; [ prikhi ];
49 };
50}