1{ 2 lib, 3 stdenv, 4 aiohttp, 5 buildPythonPackage, 6 setuptools, 7 eventlet, 8 fetchFromGitHub, 9 iana-etc, 10 libredirect, 11 mock, 12 pytest-asyncio, 13 pytestCheckHook, 14 pythonOlder, 15 requests, 16 simple-websocket, 17 tornado, 18 websocket-client, 19}: 20 21buildPythonPackage rec { 22 pname = "python-engineio"; 23 version = "4.12.2"; 24 pyproject = true; 25 26 disabled = pythonOlder "3.8"; 27 28 src = fetchFromGitHub { 29 owner = "miguelgrinberg"; 30 repo = "python-engineio"; 31 tag = "v${version}"; 32 hash = "sha256-VgdqVzO3UToXpD9pMEDqAH2DfdBwaWUfulALAEG2DNs="; 33 }; 34 35 build-system = [ setuptools ]; 36 37 dependencies = [ simple-websocket ]; 38 39 optional-dependencies = { 40 client = [ 41 requests 42 websocket-client 43 ]; 44 asyncio_client = [ aiohttp ]; 45 }; 46 47 nativeCheckInputs = [ 48 eventlet 49 libredirect.hook 50 mock 51 tornado 52 pytest-asyncio 53 pytestCheckHook 54 ] 55 ++ lib.flatten (builtins.attrValues optional-dependencies); 56 57 preCheck = lib.optionalString stdenv.hostPlatform.isLinux '' 58 echo "nameserver 127.0.0.1" > resolv.conf 59 export NIX_REDIRECTS=/etc/protocols=${iana-etc}/etc/protocols:/etc/resolv.conf=$(realpath resolv.conf) 60 ''; 61 62 postCheck = '' 63 unset NIX_REDIRECTS LD_PRELOAD 64 ''; 65 66 disabledTests = [ 67 # Assertion issue 68 "test_async_mode_eventlet" 69 # Somehow effective log level does not change? 70 "test_logger" 71 ]; 72 73 pythonImportsCheck = [ "engineio" ]; 74 75 meta = with lib; { 76 description = "Python based Engine.IO client and server"; 77 longDescription = '' 78 Engine.IO is a lightweight transport protocol that enables real-time 79 bidirectional event-based communication between clients and a server. 80 ''; 81 homepage = "https://github.com/miguelgrinberg/python-engineio/"; 82 changelog = "https://github.com/miguelgrinberg/python-engineio/blob/${src.tag}/CHANGES.md"; 83 license = with licenses; [ mit ]; 84 maintainers = with maintainers; [ mic92 ]; 85 }; 86}