at 22.05-pre 2.0 kB view raw
1{ lib 2, stdenv 3, buildPythonPackage 4, pythonOlder 5, fetchPypi 6, libuv 7, CoreServices 8, ApplicationServices 9# Check Inputs 10, aiohttp 11, psutil 12, pyopenssl 13, pytestCheckHook 14}: 15 16buildPythonPackage rec { 17 pname = "uvloop"; 18 version = "0.16.0"; 19 disabled = pythonOlder "3.7"; 20 21 src = fetchPypi { 22 inherit pname version; 23 sha256 = "f74bc20c7b67d1c27c72601c78cf95be99d5c2cdd4514502b4f3eb0933ff1228"; 24 }; 25 26 buildInputs = [ 27 libuv 28 ] ++ lib.optionals stdenv.isDarwin [ 29 CoreServices 30 ApplicationServices 31 ]; 32 33 dontUseSetuptoolsCheck = true; 34 checkInputs = [ 35 aiohttp 36 pytestCheckHook 37 pyopenssl 38 psutil 39 ]; 40 41 pytestFlagsArray = [ 42 # from pytest.ini, these are NECESSARY to prevent failures 43 "--capture=no" 44 "--assert=plain" 45 "--strict" 46 "--tb=native" 47 ] ++ lib.optionals (stdenv.isAarch64) [ 48 # test gets stuck in epoll_pwait on hydras aarch64 builders 49 # https://github.com/MagicStack/uvloop/issues/412 50 "--deselect" "tests/test_tcp.py::Test_AIO_TCPSSL::test_remote_shutdown_receives_trailing_data" 51 ] ++ lib.optionals (stdenv.isDarwin && stdenv.isAarch64) [ 52 # Flaky test: https://github.com/MagicStack/uvloop/issues/412 53 "--deselect" "tests/test_tcp.py::Test_UV_TCPSSL::test_shutdown_timeout_handler_not_set" 54 ]; 55 56 disabledTestPaths = [ 57 # ignore code linting tests 58 "tests/test_sourcecode.py" 59 ]; 60 61 # force using installed/compiled uvloop vs source by moving tests to temp dir 62 preCheck = '' 63 export TEST_DIR=$(mktemp -d) 64 cp -r tests $TEST_DIR 65 pushd $TEST_DIR 66 ''; 67 68 postCheck = '' 69 popd 70 ''; 71 72 pythonImportsCheck = [ 73 "uvloop" 74 "uvloop.loop" 75 ]; 76 77 # Some of the tests use localhost networking. 78 __darwinAllowLocalNetworking = true; 79 80 meta = with lib; { 81 description = "Fast implementation of asyncio event loop on top of libuv"; 82 homepage = "https://github.com/MagicStack/uvloop"; 83 license = licenses.mit; 84 maintainers = with maintainers; [ costrouc ]; 85 }; 86}