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
|
2021-02-10 14:41:17 +00:00
|
|
|
, pythonOlder
|
2019-05-07 13:53:23 +01:00
|
|
|
, fetchPypi
|
|
|
|
, libuv
|
2019-09-02 03:53:50 +01:00
|
|
|
, CoreServices
|
|
|
|
, ApplicationServices
|
2020-04-03 21:22:04 +01:00
|
|
|
# Check Inputs
|
2021-02-10 14:41:17 +00:00
|
|
|
, aiohttp
|
|
|
|
, psutil
|
|
|
|
, pyopenssl
|
2020-04-03 21:22:04 +01:00
|
|
|
, pytestCheckHook
|
2019-05-07 13:53:23 +01:00
|
|
|
}:
|
|
|
|
|
|
|
|
buildPythonPackage rec {
|
|
|
|
pname = "uvloop";
|
2021-02-20 09:09:19 +00:00
|
|
|
version = "0.15.2";
|
2021-02-10 14:41:17 +00:00
|
|
|
disabled = pythonOlder "3.7";
|
2019-05-07 13:53:23 +01:00
|
|
|
|
|
|
|
src = fetchPypi {
|
|
|
|
inherit pname version;
|
2021-02-20 09:09:19 +00:00
|
|
|
sha256 = "2bb0624a8a70834e54dde8feed62ed63b50bad7a1265c40d6403a2ac447bce01";
|
2019-05-07 13:53:23 +01:00
|
|
|
};
|
|
|
|
|
2019-09-02 03:53:50 +01:00
|
|
|
buildInputs = [
|
|
|
|
libuv
|
2021-02-10 14:41:17 +00:00
|
|
|
] ++ lib.optionals stdenv.isDarwin [
|
|
|
|
CoreServices
|
|
|
|
ApplicationServices
|
2020-04-03 21:22:04 +01:00
|
|
|
];
|
|
|
|
|
|
|
|
dontUseSetuptoolsCheck = true;
|
2021-02-10 14:41:17 +00:00
|
|
|
checkInputs = [
|
|
|
|
aiohttp
|
|
|
|
pytestCheckHook
|
|
|
|
pyopenssl
|
|
|
|
psutil
|
|
|
|
];
|
2020-04-03 21:22:04 +01:00
|
|
|
|
|
|
|
pytestFlagsArray = [
|
|
|
|
# from pytest.ini, these are NECESSARY to prevent failures
|
|
|
|
"--capture=no"
|
|
|
|
"--assert=plain"
|
2021-02-10 14:41:17 +00:00
|
|
|
"--strict"
|
2020-04-03 21:22:04 +01:00
|
|
|
"--tb=native"
|
|
|
|
# ignore code linting tests
|
|
|
|
"--ignore=tests/test_sourcecode.py"
|
|
|
|
];
|
2019-05-07 13:53:23 +01:00
|
|
|
|
2020-04-03 21:22:04 +01:00
|
|
|
# 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
|
|
|
|
'';
|
2021-02-10 14:41:17 +00:00
|
|
|
|
2020-04-03 21:22:04 +01:00
|
|
|
postCheck = ''
|
|
|
|
popd
|
|
|
|
'';
|
2019-05-07 13:53:23 +01:00
|
|
|
|
2021-02-10 14:41:17 +00:00
|
|
|
pythonImportsCheck = [
|
|
|
|
"uvloop"
|
|
|
|
"uvloop.loop"
|
|
|
|
];
|
|
|
|
|
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
|
|
|
};
|
|
|
|
}
|