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