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