2020-04-24 23:36:52 +00:00
|
|
|
{ lib
|
|
|
|
, stdenv
|
|
|
|
, buildPythonPackage
|
2021-02-13 14:23:35 +00:00
|
|
|
, pythonOlder
|
2020-04-24 23:36:52 +00:00
|
|
|
, fetchPypi
|
|
|
|
, libuv
|
|
|
|
, CoreServices
|
|
|
|
, ApplicationServices
|
|
|
|
# Check Inputs
|
2021-02-13 14:23:35 +00:00
|
|
|
, aiohttp
|
|
|
|
, psutil
|
|
|
|
, pyopenssl
|
2020-04-24 23:36:52 +00:00
|
|
|
, pytestCheckHook
|
|
|
|
}:
|
|
|
|
|
|
|
|
buildPythonPackage rec {
|
|
|
|
pname = "uvloop";
|
2021-09-18 10:52:07 +00:00
|
|
|
version = "0.16.0";
|
2021-02-13 14:23:35 +00:00
|
|
|
disabled = pythonOlder "3.7";
|
2020-04-24 23:36:52 +00:00
|
|
|
|
|
|
|
src = fetchPypi {
|
|
|
|
inherit pname version;
|
2021-09-18 10:52:07 +00:00
|
|
|
sha256 = "f74bc20c7b67d1c27c72601c78cf95be99d5c2cdd4514502b4f3eb0933ff1228";
|
2020-04-24 23:36:52 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
buildInputs = [
|
|
|
|
libuv
|
2021-02-13 14:23:35 +00:00
|
|
|
] ++ lib.optionals stdenv.isDarwin [
|
|
|
|
CoreServices
|
|
|
|
ApplicationServices
|
2020-04-24 23:36:52 +00:00
|
|
|
];
|
|
|
|
|
|
|
|
dontUseSetuptoolsCheck = true;
|
2021-02-13 14:23:35 +00:00
|
|
|
checkInputs = [
|
|
|
|
aiohttp
|
|
|
|
pytestCheckHook
|
|
|
|
pyopenssl
|
|
|
|
psutil
|
|
|
|
];
|
2020-04-24 23:36:52 +00:00
|
|
|
|
2022-01-03 16:56:52 +00:00
|
|
|
LIBUV_CONFIGURE_HOST = stdenv.hostPlatform.config;
|
|
|
|
|
2020-04-24 23:36:52 +00:00
|
|
|
pytestFlagsArray = [
|
|
|
|
# from pytest.ini, these are NECESSARY to prevent failures
|
|
|
|
"--capture=no"
|
|
|
|
"--assert=plain"
|
2021-02-13 14:23:35 +00:00
|
|
|
"--strict"
|
2020-04-24 23:36:52 +00:00
|
|
|
"--tb=native"
|
2021-05-20 23:08:51 +00:00
|
|
|
] ++ lib.optionals (stdenv.isAarch64) [
|
|
|
|
# test gets stuck in epoll_pwait on hydras aarch64 builders
|
|
|
|
# https://github.com/MagicStack/uvloop/issues/412
|
|
|
|
"--deselect" "tests/test_tcp.py::Test_AIO_TCPSSL::test_remote_shutdown_receives_trailing_data"
|
2021-06-28 23:13:55 +00:00
|
|
|
] ++ lib.optionals (stdenv.isDarwin && stdenv.isAarch64) [
|
|
|
|
# Flaky test: https://github.com/MagicStack/uvloop/issues/412
|
|
|
|
"--deselect" "tests/test_tcp.py::Test_UV_TCPSSL::test_shutdown_timeout_handler_not_set"
|
2022-03-05 16:20:37 +00:00
|
|
|
# Broken: https://github.com/NixOS/nixpkgs/issues/160904
|
|
|
|
"--deselect" "tests/test_context.py::Test_UV_Context::test_create_ssl_server_manual_connection_lost"
|
2021-05-20 23:08:51 +00:00
|
|
|
];
|
|
|
|
|
|
|
|
disabledTestPaths = [
|
2020-04-24 23:36:52 +00:00
|
|
|
# ignore code linting tests
|
2021-05-20 23:08:51 +00:00
|
|
|
"tests/test_sourcecode.py"
|
2020-04-24 23:36:52 +00: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-13 14:23:35 +00:00
|
|
|
|
2020-04-24 23:36:52 +00:00
|
|
|
postCheck = ''
|
|
|
|
popd
|
|
|
|
'';
|
|
|
|
|
2021-02-13 14:23:35 +00:00
|
|
|
pythonImportsCheck = [
|
|
|
|
"uvloop"
|
|
|
|
"uvloop.loop"
|
|
|
|
];
|
|
|
|
|
2020-04-24 23:36:52 +00:00
|
|
|
# Some of the tests use localhost networking.
|
|
|
|
__darwinAllowLocalNetworking = true;
|
|
|
|
|
|
|
|
meta = with lib; {
|
|
|
|
description = "Fast implementation of asyncio event loop on top of libuv";
|
|
|
|
homepage = "https://github.com/MagicStack/uvloop";
|
|
|
|
license = licenses.mit;
|
|
|
|
maintainers = with maintainers; [ costrouc ];
|
|
|
|
};
|
|
|
|
}
|