Clone of https://github.com/NixOS/nixpkgs.git (to stress-test knotserver)
at 20.09 1.9 kB view raw
1{ lib 2, stdenv 3, buildPythonPackage 4, fetchPypi 5, pyopenssl 6, libuv 7, psutil 8, isPy27 9, pythonAtLeast 10, CoreServices 11, ApplicationServices 12# Check Inputs 13, pytestCheckHook 14# , pytest-asyncio 15}: 16 17buildPythonPackage rec { 18 pname = "uvloop"; 19 version = "0.14.0"; 20 disabled = isPy27; 21 22 src = fetchPypi { 23 inherit pname version; 24 sha256 = "07j678z9gf41j98w72ysrnb5sa41pl5yxd7ib17lcwfxqz0cjfhj"; 25 }; 26 27 patches = lib.optional stdenv.isDarwin ./darwin_sandbox.patch; 28 29 buildInputs = [ 30 libuv 31 ] ++ lib.optionals stdenv.isDarwin [ CoreServices ApplicationServices ]; 32 33 pythonImportsCheck = [ 34 "uvloop" 35 "uvloop.loop" 36 ]; 37 38 dontUseSetuptoolsCheck = true; 39 checkInputs = [ pytestCheckHook pyopenssl psutil ]; 40 41 pytestFlagsArray = [ 42 # from pytest.ini, these are NECESSARY to prevent failures 43 "--capture=no" 44 "--assert=plain" 45 "--tb=native" 46 # ignore code linting tests 47 "--ignore=tests/test_sourcecode.py" 48 ]; 49 50 disabledTests = [ 51 "test_sock_cancel_add_reader_race" # asyncio version of test is supposed to be skipped but skip doesn't happen. uvloop version runs fine 52 ] ++ lib.optionals (pythonAtLeast "3.8") [ "test_write_to_closed_transport" ]; # https://github.com/MagicStack/uvloop/issues/355 53 54 # force using installed/compiled uvloop vs source by moving tests to temp dir 55 preCheck = '' 56 export TEST_DIR=$(mktemp -d) 57 cp -r tests $TEST_DIR 58 pushd $TEST_DIR 59 '' + lib.optionalString stdenv.isDarwin '' 60 # Some tests fail on Darwin 61 rm tests/test_[stu]*.py 62 ''; 63 postCheck = '' 64 popd 65 ''; 66 67 # Some of the tests use localhost networking. 68 __darwinAllowLocalNetworking = true; 69 70 meta = with lib; { 71 description = "Fast implementation of asyncio event loop on top of libuv"; 72 homepage = "https://github.com/MagicStack/uvloop"; 73 license = licenses.mit; 74 maintainers = with maintainers; [ costrouc ]; 75 }; 76}