nixpkgs mirror (for testing) github.com/NixOS/nixpkgs
nix
at python-updates 112 lines 3.1 kB view raw
1{ 2 lib, 3 stdenv, 4 buildPythonPackage, 5 pythonOlder, 6 fetchFromGitHub, 7 fetchpatch, 8 9 # build-system 10 cython, 11 setuptools, 12 13 # native dependencies 14 libuv, 15 16 # tests 17 psutil, 18 pyopenssl, 19 pytestCheckHook, 20}: 21 22buildPythonPackage rec { 23 pname = "uvloop"; 24 version = "0.22.1"; 25 pyproject = true; 26 27 src = fetchFromGitHub { 28 owner = "MagicStack"; 29 repo = "uvloop"; 30 tag = "v${version}"; 31 hash = "sha256-9NJugzxFycr1LLZXiDKbpeVcIvlCPHHIcYMp8jmffuE="; 32 }; 33 34 postPatch = '' 35 rm -rf vendor 36 37 substituteInPlace setup.py \ 38 --replace-fail "use_system_libuv = False" "use_system_libuv = True" 39 ''; 40 41 build-system = [ 42 cython 43 setuptools 44 ]; 45 46 env.LIBUV_CONFIGURE_HOST = stdenv.hostPlatform.config; 47 48 buildInputs = [ libuv ]; 49 50 nativeCheckInputs = [ 51 pyopenssl 52 pytestCheckHook 53 psutil 54 ]; 55 56 disabledTestPaths = [ 57 # ignore code linting tests 58 "tests/test_sourcecode.py" 59 # Tries to run "env", but fails to find it, even with coreutils provided 60 "tests/test_process.py::Test_UV_Process::test_process_env_2" 61 "tests/test_process.py::Test_AIO_Process::test_process_env_2" 62 # AssertionError: b'' != b'out\n' 63 "tests/test_process.py::Test_UV_Process::test_process_streams_redirect" 64 "tests/test_process.py::Test_AIO_Process::test_process_streams_redirect" 65 # Depends on performance of builder 66 "tests/test_base.py::TestBaseUV.test_call_at" 67 # Pointless and flaky (at least on darwin, depending on the sandbox perhaps) 68 "tests/test_dns.py" 69 # Asserts on exact wording of error message 70 "tests/test_tcp.py::Test_AIO_TCP::test_create_connection_open_con_addr" 71 # ConnectionAbortedError: SSL handshake is taking longer than 15.0 seconds 72 "tests/test_tcp.py::Test_AIO_TCPSSL::test_create_connection_ssl_1" 73 # Fails randomly on hydra 74 # https://github.com/MagicStack/uvloop/issues/709 75 "tests/test_process.py::TestAsyncio_AIO_Process::test_cancel_post_init" 76 ] 77 ++ lib.optionals (pythonOlder "3.11") [ 78 "tests/test_tcp.py::Test_UV_TCPSSL::test_create_connection_ssl_failed_certificat" 79 ] 80 ++ lib.optionals (stdenv.hostPlatform.isDarwin) [ 81 # Segmentation fault 82 "tests/test_fs_event.py::Test_UV_FS_EVENT_RENAME::test_fs_event_rename" 83 # Broken: https://github.com/NixOS/nixpkgs/issues/160904 84 "tests/test_context.py::Test_UV_Context::test_create_ssl_server_manual_connection_lost" 85 ]; 86 87 preCheck = '' 88 # force using installed/compiled uvloop 89 rm -rf uvloop 90 '' 91 + lib.optionalString stdenv.hostPlatform.isDarwin '' 92 # Work around "OSError: AF_UNIX path too long" 93 # https://github.com/MagicStack/uvloop/issues/463 94 export TMPDIR="/tmp" 95 ''; 96 97 pythonImportsCheck = [ 98 "uvloop" 99 "uvloop.loop" 100 ]; 101 102 # Some of the tests use localhost networking. 103 __darwinAllowLocalNetworking = true; 104 105 meta = { 106 changelog = "https://github.com/MagicStack/uvloop/releases/tag/${src.tag}"; 107 description = "Fast implementation of asyncio event loop on top of libuv"; 108 homepage = "https://github.com/MagicStack/uvloop"; 109 license = lib.licenses.mit; 110 maintainers = [ ]; 111 }; 112}