1{
2 lib,
3 buildPythonPackage,
4 fetchFromGitHub,
5 pytest-asyncio,
6 pytest-cov-stub,
7 pytestCheckHook,
8 pythonOlder,
9}:
10
11buildPythonPackage rec {
12 pname = "sockio";
13 version = "0.15.0";
14 format = "setuptools";
15
16 disabled = pythonOlder "3.7";
17
18 src = fetchFromGitHub {
19 owner = "tiagocoutinho";
20 repo = "sockio";
21 tag = "v${version}";
22 hash = "sha256-NSGd7/k1Yr408dipMNBSPRSwQ+wId7VLxgqMM/UmN/Q=";
23 };
24
25 postPatch = ''
26 substituteInPlace setup.cfg \
27 --replace "--durations=2 --verbose" ""
28 '';
29
30 __darwinAllowLocalNetworking = true;
31
32 nativeCheckInputs = [
33 pytest-asyncio
34 pytest-cov-stub
35 pytestCheckHook
36 ];
37
38 pythonImportsCheck = [ "sockio" ];
39
40 disabledTests = [
41 # Tests require network access
42 "test_open_timeout"
43 "test_write_readline_error"
44 "test_open_close"
45 "test_callbacks"
46 "test_coroutine_callbacks"
47 "test_error_callback"
48 "test_eof_callback"
49 "test_write_read"
50 "test_write_readline"
51 "test_write_readlines"
52 "test_writelines_readlines"
53 "test_writelines"
54 "test_readline"
55 "test_readuntil"
56 "test_readexactly"
57 "test_readlines"
58 "test_read"
59 "test_readbuffer"
60 "test_parallel_rw"
61 "test_parallel"
62 "test_stream"
63 "test_timeout"
64 "test_line_stream"
65 "test_block_stream"
66 "test_socket_for_url"
67 "test_root_socket_for_url"
68 ];
69
70 disabledTestPaths = [
71 # We don't care about Python 2.x
72 "tests/test_py2.py"
73 ];
74
75 meta = with lib; {
76 description = "Implementation of the Modbus protocol";
77 homepage = "https://tiagocoutinho.github.io/sockio/";
78 license = with licenses; [ gpl3Plus ];
79 maintainers = with maintainers; [ fab ];
80 };
81}