1{ stdenv, buildPythonPackage, fetchurl, python,
2 zope_interface, incremental, automat, constantly, hyperlink
3}:
4buildPythonPackage rec {
5 pname = "Twisted";
6 name = "${pname}-${version}";
7 version = "17.5.0";
8
9 src = fetchurl {
10 url = "mirror://pypi/T/Twisted/${name}.tar.bz2";
11 sha256 = "1sh2h23nnizcdyrl2rn7zxijglikxwz7z7grqpvq496zy2aa967i";
12 };
13
14 propagatedBuildInputs = [ zope_interface incremental automat constantly hyperlink ];
15
16 # Patch t.p._inotify to point to libc. Without this,
17 # twisted.python.runtime.platform.supportsINotify() == False
18 patchPhase = stdenv.lib.optionalString stdenv.isLinux ''
19 substituteInPlace src/twisted/python/_inotify.py --replace \
20 "ctypes.util.find_library('c')" "'${stdenv.glibc.out}/lib/libc.so.6'"
21 '';
22
23 # Generate Twisted's plug-in cache. Twisted users must do it as well. See
24 # http://twistedmatrix.com/documents/current/core/howto/plugin.html#auto3
25 # and http://bugs.debian.org/cgi-bin/bugreport.cgi?bug=477103 for
26 # details.
27 postInstall = "$out/bin/twistd --help > /dev/null";
28
29 checkPhase = ''
30 ${python.interpreter} -m unittest discover -s twisted/test
31 '';
32 # Tests require network
33 doCheck = false;
34
35 meta = with stdenv.lib; {
36 homepage = http://twistedmatrix.com/;
37 description = "Twisted, an event-driven networking engine written in Python";
38 longDescription = ''
39 Twisted is an event-driven networking engine written in Python
40 and licensed under the MIT license.
41 '';
42 license = licenses.mit;
43 maintainers = [ ];
44 };
45}