summary refs log tree commit diff
path: root/pkgs/development/python-modules/uvloop/default.nix
blob: 00e2c5e2a4b4aaeed34076411d87de7aa92567c8 (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
{ lib
, stdenv
, buildPythonPackage
, fetchPypi
, pyopenssl
, libuv
, psutil
, isPy27
, pythonAtLeast
, CoreServices
, ApplicationServices
}:

buildPythonPackage rec {
  pname = "uvloop";
  version = "0.14.0";
  # python 3.8 hangs on tests, assuming it's subtly broken with race condition
  disabled = isPy27 || pythonAtLeast "3.8";

  src = fetchPypi {
    inherit pname version;
    sha256 = "07j678z9gf41j98w72ysrnb5sa41pl5yxd7ib17lcwfxqz0cjfhj";
  };

  patches = lib.optional stdenv.isDarwin ./darwin_sandbox.patch;

  buildInputs = [
    libuv
  ] ++ lib.optionals stdenv.isDarwin [ CoreServices ApplicationServices ];

  postPatch = ''
    # Removing code linting tests, which we don't care about
    rm tests/test_sourcecode.py
  '';

  checkInputs = [ pyopenssl psutil ];

  # Some of the tests use localhost networking.
  __darwinAllowLocalNetworking = true;

  meta = with lib; {
    description = "Fast implementation of asyncio event loop on top of libuv";
    homepage = http://github.com/MagicStack/uvloop;
    license = licenses.mit;
    maintainers = [ maintainers.costrouc ];
  };
}