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