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