2019-05-07 13:53:23 +01:00
|
|
|
{ lib
|
2019-09-02 03:53:50 +01:00
|
|
|
, stdenv
|
2019-05-07 13:53:23 +01:00
|
|
|
, buildPythonPackage
|
|
|
|
, fetchPypi
|
|
|
|
, pyopenssl
|
|
|
|
, libuv
|
|
|
|
, psutil
|
|
|
|
, isPy27
|
2019-09-02 03:53:50 +01:00
|
|
|
, CoreServices
|
|
|
|
, ApplicationServices
|
2020-04-03 21:22:04 +01:00
|
|
|
# Check Inputs
|
|
|
|
, pytestCheckHook
|
|
|
|
# , pytest-asyncio
|
2019-05-07 13:53:23 +01:00
|
|
|
}:
|
|
|
|
|
|
|
|
buildPythonPackage rec {
|
|
|
|
pname = "uvloop";
|
2019-11-11 21:08:07 +00:00
|
|
|
version = "0.14.0";
|
2020-04-03 21:22:04 +01:00
|
|
|
disabled = isPy27;
|
2019-05-07 13:53:23 +01:00
|
|
|
|
|
|
|
src = fetchPypi {
|
|
|
|
inherit pname version;
|
2019-11-11 21:08:07 +00:00
|
|
|
sha256 = "07j678z9gf41j98w72ysrnb5sa41pl5yxd7ib17lcwfxqz0cjfhj";
|
2019-05-07 13:53:23 +01:00
|
|
|
};
|
|
|
|
|
2019-09-13 22:11:56 +01:00
|
|
|
patches = lib.optional stdenv.isDarwin ./darwin_sandbox.patch;
|
|
|
|
|
2019-09-02 03:53:50 +01:00
|
|
|
buildInputs = [
|
|
|
|
libuv
|
|
|
|
] ++ lib.optionals stdenv.isDarwin [ CoreServices ApplicationServices ];
|
|
|
|
|
2020-04-03 21:22:04 +01:00
|
|
|
pythonImportsCheck = [
|
|
|
|
"uvloop"
|
|
|
|
"uvloop.loop"
|
|
|
|
];
|
|
|
|
|
|
|
|
dontUseSetuptoolsCheck = true;
|
|
|
|
checkInputs = [ pytestCheckHook pyopenssl psutil ];
|
|
|
|
|
|
|
|
pytestFlagsArray = [
|
|
|
|
# from pytest.ini, these are NECESSARY to prevent failures
|
|
|
|
"--capture=no"
|
|
|
|
"--assert=plain"
|
|
|
|
"--tb=native"
|
|
|
|
# ignore code linting tests
|
|
|
|
"--ignore=tests/test_sourcecode.py"
|
2020-06-24 21:34:46 +01:00
|
|
|
# Fails on Python 3.8
|
|
|
|
# https://salsa.debian.org/python-team/modules/uvloop/-/commit/302a7e8f5a2869e13d0550cd37e7a8f480e79869
|
|
|
|
"--ignore=tests/test_tcp.py"
|
2020-04-03 21:22:04 +01:00
|
|
|
];
|
2019-05-07 13:53:23 +01:00
|
|
|
|
2020-04-03 21:22:04 +01:00
|
|
|
disabledTests = [
|
|
|
|
"test_sock_cancel_add_reader_race" # asyncio version of test is supposed to be skipped but skip doesn't happen. uvloop version runs fine
|
|
|
|
];
|
|
|
|
|
|
|
|
# force using installed/compiled uvloop vs source by moving tests to temp dir
|
|
|
|
preCheck = ''
|
|
|
|
export TEST_DIR=$(mktemp -d)
|
|
|
|
cp -r tests $TEST_DIR
|
|
|
|
pushd $TEST_DIR
|
2020-06-19 20:14:54 +01:00
|
|
|
'' + lib.optionalString stdenv.isDarwin ''
|
|
|
|
# Some tests fail on Darwin
|
|
|
|
rm tests/test_[stu]*.py
|
2020-04-03 21:22:04 +01:00
|
|
|
'';
|
|
|
|
postCheck = ''
|
|
|
|
popd
|
|
|
|
'';
|
2019-05-07 13:53:23 +01:00
|
|
|
|
2019-09-13 22:11:56 +01:00
|
|
|
# Some of the tests use localhost networking.
|
|
|
|
__darwinAllowLocalNetworking = true;
|
|
|
|
|
2019-05-07 13:53:23 +01:00
|
|
|
meta = with lib; {
|
|
|
|
description = "Fast implementation of asyncio event loop on top of libuv";
|
2020-04-03 21:22:04 +01:00
|
|
|
homepage = "https://github.com/MagicStack/uvloop";
|
2019-05-07 13:53:23 +01:00
|
|
|
license = licenses.mit;
|
2020-04-03 21:22:04 +01:00
|
|
|
maintainers = with maintainers; [ costrouc ];
|
2019-05-07 13:53:23 +01:00
|
|
|
};
|
|
|
|
}
|