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