1{ stdenv
2, buildPythonPackage
3, isPy3k
4, fetchPypi
5, html5lib
6, wcwidth
7, pytest
8}:
9
10buildPythonPackage rec {
11 pname = "ftfy";
12
13 version = "5.6";
14 # ftfy v5 only supports python3. Since at the moment the only
15 # packages that use ftfy are spacy and textacy which both support
16 # python 2 and 3, they have pinned ftfy to the v4 branch.
17 # I propose to stick to v4 until another package requires v5.
18 # At that point we can make a ftfy_v4 package.
19 disabled = !isPy3k;
20
21 src = fetchPypi {
22 inherit pname version;
23 sha256 = "1k4vr5rfa62yafwpmb4827n50pwb79if0vhg1y4yqbb0bv20jxbd";
24 };
25
26 propagatedBuildInputs = [
27 html5lib
28 wcwidth
29 ];
30
31 checkInputs = [
32 pytest
33 ];
34
35 # We suffix PATH like this because the tests want the ftfy executable
36 checkPhase = ''
37 PATH=$out/bin:$PATH pytest
38 '';
39
40 meta = with stdenv.lib; {
41 description = "Given Unicode text, make its representation consistent and possibly less broken";
42 homepage = https://github.com/LuminosoInsight/python-ftfy;
43 license = licenses.mit;
44 maintainers = with maintainers; [ sdll aborsu ];
45 };
46}