1{ lib
2, stdenv
3, buildPythonPackage
4, fetchFromGitHub
5, pythonOlder
6, dnspython
7, greenlet
8, monotonic
9, six
10, nose
11, iana-etc
12, pytestCheckHook
13, libredirect
14}:
15
16buildPythonPackage rec {
17 pname = "eventlet";
18 version = "0.33.1";
19 format = "setuptools";
20
21 src = fetchFromGitHub {
22 owner = "eventlet";
23 repo = pname;
24 rev = "v${version}";
25 hash = "sha256-8tIvvTTCcIG56VaPZMhdzAKnFRsYV3YC9xcf47nh838=";
26 };
27
28 propagatedBuildInputs = [
29 dnspython
30 greenlet
31 six
32 ] ++ lib.optionals (pythonOlder "3.5") [
33 monotonic
34 ];
35
36 checkInputs = [
37 pytestCheckHook
38 nose
39 ];
40
41 doCheck = !stdenv.isDarwin;
42
43 preCheck = lib.optionalString doCheck ''
44 echo "nameserver 127.0.0.1" > resolv.conf
45 export NIX_REDIRECTS=/etc/protocols=${iana-etc}/etc/protocols:/etc/resolv.conf=$(realpath resolv.conf)
46 export LD_PRELOAD=${libredirect}/lib/libredirect.so
47
48 export EVENTLET_IMPORT_VERSION_ONLY=0
49 '';
50
51 disabledTests = [
52 # Tests requires network access
53 "test_017_ssl_zeroreturnerror"
54 "test_018b_http_10_keepalive_framing"
55 "test_getaddrinfo"
56 "test_hosts_no_network"
57 "test_leakage_from_tracebacks"
58 "test_patcher_existing_locks_locked"
59 # broken with pyopenssl 22.0.0
60 "test_sendall_timeout"
61 ] ++ lib.optionals stdenv.isAarch64 [
62 "test_fork_after_monkey_patch"
63 ];
64
65 disabledTestPaths = [
66 # Tests are out-dated
67 "tests/stdlib/test_asynchat.py"
68 "tests/stdlib/test_asyncore.py"
69 "tests/stdlib/test_ftplib.py"
70 "tests/stdlib/test_httplib.py"
71 "tests/stdlib/test_httpservers.py"
72 "tests/stdlib/test_os.py"
73 "tests/stdlib/test_queue.py"
74 "tests/stdlib/test_select.py"
75 "tests/stdlib/test_SimpleHTTPServer.py"
76 "tests/stdlib/test_socket_ssl.py"
77 "tests/stdlib/test_socket.py"
78 "tests/stdlib/test_socketserver.py"
79 "tests/stdlib/test_ssl.py"
80 "tests/stdlib/test_subprocess.py"
81 "tests/stdlib/test_thread__boundedsem.py"
82 "tests/stdlib/test_thread.py"
83 "tests/stdlib/test_threading_local.py"
84 "tests/stdlib/test_threading.py"
85 "tests/stdlib/test_timeout.py"
86 "tests/stdlib/test_urllib.py"
87 "tests/stdlib/test_urllib2_localnet.py"
88 "tests/stdlib/test_urllib2.py"
89 ];
90
91 # unfortunately, it needs /etc/protocol to be present to not fail
92 # pythonImportsCheck = [ "eventlet" ];
93
94 meta = with lib; {
95 description = "A concurrent networking library for Python";
96 homepage = "https://github.com/eventlet/eventlet/";
97 license = licenses.mit;
98 maintainers = with maintainers; [ SuperSandro2000 ];
99 };
100}