1{ lib
2, stdenv
3, buildPythonPackage
4, fetchPypi
5, pythonOlder
6, dnspython
7, greenlet
8, monotonic
9, six
10, nose
11, pyopenssl
12, iana-etc
13, libredirect
14}:
15
16buildPythonPackage rec {
17 pname = "eventlet";
18 version = "0.32.0";
19
20 src = fetchPypi {
21 inherit pname version;
22 sha256 = "2f0bb8ed0dc0ab21d683975d5d8ab3c054d588ce61def9faf7a465ee363e839b";
23 };
24
25 propagatedBuildInputs = [ dnspython greenlet pyopenssl six ]
26 ++ lib.optional (pythonOlder "3.5") monotonic;
27
28 checkInputs = [ nose ];
29
30 doCheck = !stdenv.isDarwin;
31
32 preCheck = lib.optionalString doCheck ''
33 echo "nameserver 127.0.0.1" > resolv.conf
34 export NIX_REDIRECTS=/etc/protocols=${iana-etc}/etc/protocols:/etc/resolv.conf=$(realpath resolv.conf)
35 export LD_PRELOAD=${libredirect}/lib/libredirect.so
36
37 export EVENTLET_IMPORT_VERSION_ONLY=0
38 '';
39
40 checkPhase = ''
41 runHook preCheck
42
43 # test_fork-after_monkey_patch fails on aarch64 on hydra only
44 # AssertionError: Expected single line "pass" in stdout
45 nosetests --exclude test_getaddrinfo --exclude test_hosts_no_network --exclude test_fork_after_monkey_patch
46
47 runHook postCheck
48 '';
49
50 # unfortunately, it needs /etc/protocol to be present to not fail
51 # pythonImportsCheck = [ "eventlet" ];
52
53 meta = with lib; {
54 homepage = "https://github.com/eventlet/eventlet/";
55 description = "A concurrent networking library for Python";
56 maintainers = with maintainers; [ SuperSandro2000 ];
57 license = licenses.mit;
58 };
59}