nixpkgs mirror (for testing)
github.com/NixOS/nixpkgs
nix
1{ lib, stdenv
2, buildPythonPackage
3, pythonOlder
4, fetchPypi
5, python
6, zope_interface
7, incremental
8, automat
9, constantly
10, hyperlink
11, pyhamcrest
12, attrs
13, pyopenssl
14, service-identity
15, setuptools
16, idna
17, typing-extensions
18, pyasn1
19, cryptography
20, appdirs
21, bcrypt
22, pynacl
23, pyserial
24, h2
25, priority
26, contextvars
27}:
28buildPythonPackage rec {
29 pname = "Twisted";
30 version = "22.4.0";
31
32 disabled = pythonOlder "3.6";
33
34 format = "setuptools";
35
36 src = fetchPypi {
37 inherit pname version;
38 extension = "tar.gz";
39 sha256 = "sha256-oEeZD1ffrh4L0rffJSbU8W3NyEN3TcEIt4xS8qXxNoA=";
40 };
41
42 propagatedBuildInputs = [ zope_interface incremental automat constantly hyperlink pyhamcrest attrs setuptools typing-extensions ];
43
44 passthru.optional-dependencies = rec {
45 tls = [ pyopenssl service-identity idna ];
46 conch = [ pyasn1 cryptography appdirs bcrypt ];
47 conch_nacl = conch ++ [ pynacl ];
48 serial = [ pyserial ];
49 http2 = [ h2 priority ];
50 contextvars = lib.optionals (pythonOlder "3.7") [ contextvars ];
51 };
52
53 # Patch t.p._inotify to point to libc. Without this,
54 # twisted.python.runtime.platform.supportsINotify() == False
55 postPatch = lib.optionalString stdenv.isLinux ''
56 substituteInPlace src/twisted/python/_inotify.py --replace \
57 "ctypes.util.find_library(\"c\")" "'${stdenv.glibc.out}/lib/libc.so.6'"
58 '';
59
60 # Generate Twisted's plug-in cache. Twisted users must do it as well. See
61 # http://twistedmatrix.com/documents/current/core/howto/plugin.html#auto3
62 # and http://bugs.debian.org/cgi-bin/bugreport.cgi?bug=477103 for
63 # details.
64 postFixup = ''
65 $out/bin/twistd --help > /dev/null
66 '';
67
68 checkPhase = ''
69 ${python.interpreter} -m unittest discover -s src/twisted/test
70 '';
71 # Tests require network
72 doCheck = false;
73
74 meta = with lib; {
75 homepage = "https://github.com/twisted/twisted";
76 description = "Twisted, an event-driven networking engine written in Python";
77 longDescription = ''
78 Twisted is an event-driven networking engine written in Python
79 and licensed under the MIT license.
80 '';
81 license = licenses.mit;
82 maintainers = [ ];
83 };
84}