Clone of https://github.com/NixOS/nixpkgs.git (to stress-test knotserver)
at litex 3.5 kB view raw
1{ lib 2, stdenv 3, buildPythonPackage 4, pythonOlder 5, fetchPypi 6, cython 7, libuv 8, CoreServices 9, ApplicationServices 10 11# Check Inputs 12, aiohttp 13, psutil 14, pyopenssl 15, pytest-forked 16, pytestCheckHook 17}: 18 19buildPythonPackage rec { 20 pname = "uvloop"; 21 version = "0.17.0"; 22 format = "setuptools"; 23 disabled = pythonOlder "3.7"; 24 25 src = fetchPypi { 26 inherit pname version; 27 hash = "sha256-Dd9rr5zxGhoixxSH858Vss9461vefltF+7meip2RueE="; 28 }; 29 30 nativeBuildInputs = [ 31 cython 32 ]; 33 34 buildInputs = [ 35 libuv 36 ] ++ lib.optionals stdenv.isDarwin [ 37 CoreServices 38 ApplicationServices 39 ]; 40 41 dontUseSetuptoolsCheck = true; 42 nativeCheckInputs = [ 43 pytest-forked 44 pytestCheckHook 45 psutil 46 ] ++ lib.optionals (pythonOlder "3.11") [ 47 aiohttp 48 ]; 49 50 LIBUV_CONFIGURE_HOST = stdenv.hostPlatform.config; 51 52 pytestFlagsArray = [ 53 # from pytest.ini, these are NECESSARY to prevent failures 54 "--capture=no" 55 "--assert=plain" 56 "--strict" 57 "--tb=native" 58 # Depend on pyopenssl 59 "--deselect=tests/test_tcp.py::Test_UV_TCPSSL::test_flush_before_shutdown" 60 "--deselect=tests/test_tcp.py::Test_UV_TCPSSL::test_renegotiation" 61 # test gets stuck in epoll_pwait on hydras aarch64 builders 62 # https://github.com/MagicStack/uvloop/issues/412 63 "--deselect=tests/test_tcp.py::Test_AIO_TCPSSL::test_remote_shutdown_receives_trailing_data" 64 # Tries to import cythonized file for which the .pyx file is not shipped via PyPi 65 "--deselect=tests/test_libuv_api.py::Test_UV_libuv::test_libuv_get_loop_t_ptr" 66 # Tries to run "env", but fails to find it 67 "--deselect=tests/test_process.py::Test_UV_Process::test_process_env_2" 68 "--deselect=tests/test_process.py::Test_AIO_Process::test_process_env_2" 69 # AssertionError: b'' != b'out\n' 70 "--deselect=tests/test_process.py::Test_UV_Process::test_process_streams_redirect" 71 "--deselect=tests/test_process.py::Test_AIO_Process::test_process_streams_redirect" 72 ] ++ lib.optionals (stdenv.isDarwin && stdenv.isx86_64) [ 73 # Segmentation fault 74 "--deselect=tests/test_fs_event.py::Test_UV_FS_EVENT_RENAME::test_fs_event_rename" 75 ] ++ lib.optionals (stdenv.isDarwin && stdenv.isAarch64) [ 76 # Broken: https://github.com/NixOS/nixpkgs/issues/160904 77 "--deselect=tests/test_context.py::Test_UV_Context::test_create_ssl_server_manual_connection_lost" 78 # Segmentation fault 79 "--deselect=tests/test_fs_event.py::Test_UV_FS_EVENT_RENAME::test_fs_event_rename" 80 ]; 81 82 disabledTestPaths = [ 83 # ignore code linting tests 84 "tests/test_sourcecode.py" 85 ]; 86 87 preCheck = lib.optionalString stdenv.isDarwin '' 88 # Work around "OSError: AF_UNIX path too long" 89 # https://github.com/MagicStack/uvloop/issues/463 90 export TMPDIR="/tmp" 91 '' + '' 92 # pyopenssl is not well supported by upstream 93 # https://github.com/NixOS/nixpkgs/issues/175875 94 substituteInPlace tests/test_tcp.py \ 95 --replace "from OpenSSL import SSL as openssl_ssl" "" 96 # force using installed/compiled uvloop vs source by moving tests to temp dir 97 export TEST_DIR=$(mktemp -d) 98 cp -r tests $TEST_DIR 99 pushd $TEST_DIR 100 ''; 101 102 postCheck = '' 103 popd 104 ''; 105 106 pythonImportsCheck = [ 107 "uvloop" 108 "uvloop.loop" 109 ]; 110 111 # Some of the tests use localhost networking. 112 __darwinAllowLocalNetworking = true; 113 114 meta = with lib; { 115 description = "Fast implementation of asyncio event loop on top of libuv"; 116 homepage = "https://github.com/MagicStack/uvloop"; 117 license = licenses.mit; 118 maintainers = with maintainers; [ costrouc ]; 119 }; 120}