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