1{ lib
2, stdenv
3, buildPythonPackage
4, fetchFromGitHub
5, aiohttp
6, eventlet
7, iana-etc
8, libredirect
9, mock
10, requests
11, six
12, tornado
13, websocket_client
14, websockets
15, pytestCheckHook
16, pythonAtLeast
17}:
18
19buildPythonPackage rec {
20 pname = "python-engineio";
21 version = "3.14.2";
22
23 src = fetchFromGitHub {
24 owner = "miguelgrinberg";
25 repo = "python-engineio";
26 rev = "v${version}";
27 sha256 = "1r3gvizrknbv036pvxid1l726wkb0l43bdaz5y879s7j3ipyb464";
28 };
29
30 propagatedBuildInputs = [
31 six
32 ];
33
34 checkInputs = [
35 aiohttp
36 eventlet
37 mock
38 requests
39 tornado
40 websocket_client
41 websockets
42 pytestCheckHook
43 ];
44
45 preCheck = lib.optionalString stdenv.isLinux ''
46 echo "nameserver 127.0.0.1" > resolv.conf
47 export NIX_REDIRECTS=/etc/protocols=${iana-etc}/etc/protocols:/etc/resolv.conf=$(realpath resolv.conf) \
48 LD_PRELOAD=${libredirect}/lib/libredirect.so
49 '';
50 postCheck = ''
51 unset NIX_REDIRECTS LD_PRELOAD
52 '';
53
54 # somehow effective log level does not change?
55 disabledTests = [ "test_logger" ];
56 pythonImportsCheck = [ "engineio" ];
57
58 meta = with lib; {
59 description = "Python based Engine.IO client and server v3.x";
60 longDescription = ''
61 Engine.IO is a lightweight transport protocol that enables real-time
62 bidirectional event-based communication between clients and a server.
63 '';
64 homepage = "https://github.com/miguelgrinberg/python-engineio/";
65 license = with licenses; [ mit ];
66 maintainers = with maintainers; [ graham33 ];
67 broken = stdenv.isDarwin && (pythonAtLeast "3.9"); # See https://github.com/miguelgrinberg/python-socketio/issues/567
68 };
69}