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 nativeBuildInputs = [
36 hatch-vcs
37 hatchling
38 ];
39
40 propagatedBuildInputs = [
41 dnspython
42 greenlet
43 six
44 ];
45
46 nativeCheckInputs = [
47 libredirect.hook
48 pytestCheckHook
49 ];
50
51 # tests hang on pypy indefinitely
52 # most tests also fail/flake on Darwin
53 doCheck = !isPyPy && !stdenv.hostPlatform.isDarwin;
54
55 preCheck = lib.optionalString doCheck ''
56 echo "nameserver 127.0.0.1" > resolv.conf
57 export NIX_REDIRECTS=/etc/protocols=${iana-etc}/etc/protocols:/etc/resolv.conf=$(realpath resolv.conf)
58
59 export EVENTLET_IMPORT_VERSION_ONLY=0
60 '';
61
62 disabledTests = [
63 # AssertionError: Expected single line "pass" in stdout
64 "test_fork_after_monkey_patch"
65 # Tests requires network access
66 "test_getaddrinfo"
67 "test_hosts_no_network"
68 # flaky test, depends on builder performance
69 "test_server_connection_timeout_exception"
70 # broken with openssl 3.4
71 "test_ssl_close"
72 # flaky test
73 "test_send_timeout"
74 ];
75
76 pythonImportsCheck = [ "eventlet" ];
77
78 meta = with lib; {
79 changelog = "https://github.com/eventlet/eventlet/blob/v${version}/NEWS";
80 description = "Concurrent networking library for Python";
81 homepage = "https://github.com/eventlet/eventlet/";
82 license = licenses.mit;
83 maintainers = with maintainers; [ SuperSandro2000 ];
84 };
85}