about summary refs log tree commit diff
path: root/nixpkgs/pkgs/development/python-modules/eventlet/default.nix
blob: 038b66a8efed56174cd0d797939589d1c7805d84 (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
{ lib
, stdenv
, buildPythonPackage
, fetchPypi
, pythonOlder
, dnspython
, greenlet
, monotonic
, six
, nose
, pyopenssl
, iana-etc
, libredirect
}:

buildPythonPackage rec {
  pname = "eventlet";
  version = "0.33.0";

  src = fetchPypi {
    inherit pname version;
    sha256 = "80144f489c1bb273a51b6f96ff9785a382d2866b9bab1f5bd748385019f4141f";
  };

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

  checkInputs = [ nose ];

  doCheck = !stdenv.isDarwin;

  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
  '';

  checkPhase = ''
    runHook preCheck

    # test_fork-after_monkey_patch fails on aarch64 on hydra only
    #   AssertionError: Expected single line "pass" in stdout
    nosetests --exclude test_getaddrinfo --exclude test_hosts_no_network --exclude test_fork_after_monkey_patch

    runHook postCheck
  '';

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

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