1{
2 lib,
3 stdenv,
4 buildPythonPackage,
5 fetchFromGitHub,
6
7 # build-system
8 hatch-vcs,
9 hatchling,
10
11 # dependencies
12 dnspython,
13 greenlet,
14 isPyPy,
15 six,
16
17 # tests
18 iana-etc,
19 pytestCheckHook,
20 libredirect,
21}:
22
23buildPythonPackage rec {
24 pname = "eventlet";
25 version = "0.40.0";
26 pyproject = true;
27
28 src = fetchFromGitHub {
29 owner = "eventlet";
30 repo = "eventlet";
31 tag = version;
32 hash = "sha256-fzCN+idYQ97nuDVfYn6VYQFBaaMxmnjWzFrmn+Aj+u4=";
33 };
34
35 pythonRelaxDeps = lib.optionals isPyPy [ "greenlet" ];
36
37 nativeBuildInputs = [
38 hatch-vcs
39 hatchling
40 ];
41
42 propagatedBuildInputs = [
43 dnspython
44 greenlet
45 six
46 ];
47
48 nativeCheckInputs = [
49 libredirect.hook
50 pytestCheckHook
51 ];
52
53 # tests hang on pypy indefinitely
54 # most tests also fail/flake on Darwin
55 doCheck = !isPyPy && !stdenv.hostPlatform.isDarwin;
56
57 preCheck = lib.optionalString doCheck ''
58 echo "nameserver 127.0.0.1" > resolv.conf
59 export NIX_REDIRECTS=/etc/protocols=${iana-etc}/etc/protocols:/etc/resolv.conf=$(realpath resolv.conf)
60
61 export EVENTLET_IMPORT_VERSION_ONLY=0
62 '';
63
64 disabledTests = [
65 # AssertionError: Expected single line "pass" in stdout
66 "test_fork_after_monkey_patch"
67 # Tests requires network access
68 "test_getaddrinfo"
69 "test_hosts_no_network"
70 # flaky test, depends on builder performance
71 "test_server_connection_timeout_exception"
72 # broken with openssl 3.4
73 "test_ssl_close"
74 # flaky test
75 "test_send_timeout"
76 ];
77
78 pythonImportsCheck = [ "eventlet" ];
79
80 meta = with lib; {
81 changelog = "https://github.com/eventlet/eventlet/blob/v${version}/NEWS";
82 description = "Concurrent networking library for Python";
83 homepage = "https://github.com/eventlet/eventlet/";
84 license = licenses.mit;
85 maintainers = with maintainers; [ SuperSandro2000 ];
86 };
87}