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.5.1";
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 = "1ci6xrj4g01a97nymxpv9nj820nlmgzc4ybaz9k46i6bnxzpax7s";
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}