summary refs log tree commit diff
path: root/pkgs/development/python-modules/eventlet/default.nix
blob: 35c702ea06d87c3af5704a53c5a81b65645e8813 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
{ lib
, stdenv
, buildPythonPackage
, fetchFromGitHub
, pythonOlder
, dnspython
, greenlet
, isPyPy
, monotonic
, six
, nose3
, iana-etc
, pytestCheckHook
, libredirect
}:

buildPythonPackage rec {
  pname = "eventlet";
  version = "0.33.3";
  format = "setuptools";

  src = fetchFromGitHub {
    owner = "eventlet";
    repo = pname;
    rev = "v${version}";
    hash = "sha256-iSSEZgPkK7RrZfU11z7hUk+JbFsCPH/SD16e+/f6TFU=";
  };

  propagatedBuildInputs = [
    dnspython
    greenlet
    six
  ] ++ lib.optionals (pythonOlder "3.5") [
    monotonic
  ];

  nativeCheckInputs = [
    pytestCheckHook
    nose3
  ];

  # libredirect is not available on darwin
  # tests hang on pypy indefinitely
  doCheck = !stdenv.isDarwin && !isPyPy;

  preCheck = lib.optionalString doCheck ''
    echo "nameserver 127.0.0.1" > resolv.conf
    export NIX_REDIRECTS=/etc/protocols=${iana-etc}/etc/protocols:/etc/resolv.conf=$(realpath resolv.conf)
    export LD_PRELOAD=${libredirect}/lib/libredirect.so

    export EVENTLET_IMPORT_VERSION_ONLY=0
  '';

  disabledTests = [
    # Tests requires network access
    "test_017_ssl_zeroreturnerror"
    "test_018b_http_10_keepalive_framing"
    "test_getaddrinfo"
    "test_hosts_no_network"
    "test_leakage_from_tracebacks"
    "test_patcher_existing_locks_locked"
    # broken with pyopenssl 22.0.0
    "test_sendall_timeout"
    # broken on aarch64 and when using march in gcc
    "test_fork_after_monkey_patch"
  ];

  disabledTestPaths = [
    # Tests are out-dated
    "tests/stdlib/test_asynchat.py"
    "tests/stdlib/test_asyncore.py"
    "tests/stdlib/test_ftplib.py"
    "tests/stdlib/test_httplib.py"
    "tests/stdlib/test_httpservers.py"
    "tests/stdlib/test_os.py"
    "tests/stdlib/test_queue.py"
    "tests/stdlib/test_select.py"
    "tests/stdlib/test_SimpleHTTPServer.py"
    "tests/stdlib/test_socket_ssl.py"
    "tests/stdlib/test_socket.py"
    "tests/stdlib/test_socketserver.py"
    "tests/stdlib/test_ssl.py"
    "tests/stdlib/test_subprocess.py"
    "tests/stdlib/test_thread__boundedsem.py"
    "tests/stdlib/test_thread.py"
    "tests/stdlib/test_threading_local.py"
    "tests/stdlib/test_threading.py"
    "tests/stdlib/test_timeout.py"
    "tests/stdlib/test_urllib.py"
    "tests/stdlib/test_urllib2_localnet.py"
    "tests/stdlib/test_urllib2.py"
  ];

  # unfortunately, it needs /etc/protocol to be present to not fail
  # pythonImportsCheck = [ "eventlet" ];

  meta = with lib; {
    description = "A concurrent networking library for Python";
    homepage = "https://github.com/eventlet/eventlet/";
    license = licenses.mit;
    maintainers = with maintainers; [ SuperSandro2000 ];
  };
}