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