1{ stdenv
2, lib
3, buildPythonPackage
4, fetchFromGitHub
5, pytestCheckHook
6, chardet
7, cssselect
8, lxml
9, timeout-decorator
10}:
11
12buildPythonPackage rec {
13 pname = "readability-lxml";
14 version = "0.8.1";
15
16 src = fetchFromGitHub {
17 owner = "buriy";
18 repo = "python-readability";
19 rev = "v${version}";
20 hash = "sha256-MKdQRety24qOG9xgIdaCJ72XEImP42SlMG6tC7bwzo4=";
21 };
22
23 propagatedBuildInputs = [ chardet cssselect lxml ];
24
25 postPatch = ''
26 substituteInPlace setup.py --replace 'sys.platform == "darwin"' "False"
27 '';
28
29 nativeCheckInputs = [
30 pytestCheckHook
31 timeout-decorator
32 ];
33
34 disabledTests = lib.optionals stdenv.isDarwin [
35 # Test is broken on darwin. Fix in master from https://github.com/buriy/python-readability/pull/178
36 "test_many_repeated_spaces"
37 ];
38
39 meta = with lib; {
40 description = "Fast python port of arc90's readability tool";
41 homepage = "https://github.com/buriy/python-readability";
42 license = licenses.asl20;
43 maintainers = with maintainers; [ siraben ];
44 };
45}