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
|
2022-09-30 11:47:45 +00:00
|
|
|
, cython
|
2020-04-24 23:36:52 +00:00
|
|
|
, libuv
|
|
|
|
, CoreServices
|
|
|
|
, ApplicationServices
|
2022-09-30 11:47:45 +00:00
|
|
|
|
|
|
|
# Check Inputs
|
2021-02-13 14:23:35 +00:00
|
|
|
, aiohttp
|
|
|
|
, psutil
|
|
|
|
, pyopenssl
|
2023-03-15 16:39:30 +00:00
|
|
|
, pytest-forked
|
2020-04-24 23:36:52 +00:00
|
|
|
, pytestCheckHook
|
|
|
|
}:
|
|
|
|
|
|
|
|
buildPythonPackage rec {
|
|
|
|
pname = "uvloop";
|
2022-09-30 11:47:45 +00:00
|
|
|
version = "0.17.0";
|
|
|
|
format = "setuptools";
|
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;
|
2022-09-30 11:47:45 +00:00
|
|
|
hash = "sha256-Dd9rr5zxGhoixxSH858Vss9461vefltF+7meip2RueE=";
|
2020-04-24 23:36:52 +00:00
|
|
|
};
|
|
|
|
|
2022-09-30 11:47:45 +00:00
|
|
|
nativeBuildInputs = [
|
|
|
|
cython
|
|
|
|
];
|
|
|
|
|
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;
|
2023-02-02 18:25:31 +00:00
|
|
|
nativeCheckInputs = [
|
2023-03-15 16:39:30 +00:00
|
|
|
pytest-forked
|
2021-02-13 14:23:35 +00:00
|
|
|
pytestCheckHook
|
|
|
|
psutil
|
2022-09-30 11:47:45 +00:00
|
|
|
] ++ lib.optionals (pythonOlder "3.11") [
|
|
|
|
aiohttp
|
2021-02-13 14:23:35 +00:00
|
|
|
];
|
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"
|
2022-08-12 12:06:08 +00:00
|
|
|
# Depend on pyopenssl
|
2022-09-30 11:47:45 +00:00
|
|
|
"--deselect=tests/test_tcp.py::Test_UV_TCPSSL::test_flush_before_shutdown"
|
|
|
|
"--deselect=tests/test_tcp.py::Test_UV_TCPSSL::test_renegotiation"
|
2021-05-20 23:08:51 +00:00
|
|
|
# test gets stuck in epoll_pwait on hydras aarch64 builders
|
|
|
|
# https://github.com/MagicStack/uvloop/issues/412
|
2022-09-30 11:47:45 +00:00
|
|
|
"--deselect=tests/test_tcp.py::Test_AIO_TCPSSL::test_remote_shutdown_receives_trailing_data"
|
|
|
|
# Tries to import cythonized file for which the .pyx file is not shipped via PyPi
|
|
|
|
"--deselect=tests/test_libuv_api.py::Test_UV_libuv::test_libuv_get_loop_t_ptr"
|
|
|
|
# Tries to run "env", but fails to find it
|
|
|
|
"--deselect=tests/test_process.py::Test_UV_Process::test_process_env_2"
|
|
|
|
"--deselect=tests/test_process.py::Test_AIO_Process::test_process_env_2"
|
2023-03-15 16:39:30 +00:00
|
|
|
# AssertionError: b'' != b'out\n'
|
|
|
|
"--deselect=tests/test_process.py::Test_UV_Process::test_process_streams_redirect"
|
|
|
|
"--deselect=tests/test_process.py::Test_AIO_Process::test_process_streams_redirect"
|
|
|
|
] ++ lib.optionals (stdenv.isDarwin && stdenv.isx86_64) [
|
|
|
|
# Segmentation fault
|
|
|
|
"--deselect=tests/test_fs_event.py::Test_UV_FS_EVENT_RENAME::test_fs_event_rename"
|
2021-06-28 23:13:55 +00:00
|
|
|
] ++ lib.optionals (stdenv.isDarwin && stdenv.isAarch64) [
|
2022-03-05 16:20:37 +00:00
|
|
|
# Broken: https://github.com/NixOS/nixpkgs/issues/160904
|
2022-09-30 11:47:45 +00:00
|
|
|
"--deselect=tests/test_context.py::Test_UV_Context::test_create_ssl_server_manual_connection_lost"
|
2023-03-15 16:39:30 +00:00
|
|
|
# Segmentation fault
|
|
|
|
"--deselect=tests/test_fs_event.py::Test_UV_FS_EVENT_RENAME::test_fs_event_rename"
|
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
|
|
|
];
|
|
|
|
|
2022-04-15 01:41:22 +00:00
|
|
|
preCheck = lib.optionalString stdenv.isDarwin ''
|
|
|
|
# Work around "OSError: AF_UNIX path too long"
|
|
|
|
# https://github.com/MagicStack/uvloop/issues/463
|
|
|
|
export TMPDIR="/tmp"
|
2022-08-12 12:06:08 +00:00
|
|
|
'' + ''
|
|
|
|
# pyopenssl is not well supported by upstream
|
|
|
|
# https://github.com/NixOS/nixpkgs/issues/175875
|
|
|
|
substituteInPlace tests/test_tcp.py \
|
|
|
|
--replace "from OpenSSL import SSL as openssl_ssl" ""
|
2022-04-15 01:41:22 +00:00
|
|
|
# force using installed/compiled uvloop vs source by moving tests to temp dir
|
2020-04-24 23:36:52 +00:00
|
|
|
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 ];
|
|
|
|
};
|
|
|
|
}
|