1{
2 lib,
3 buildPythonPackage,
4 fetchFromGitHub,
5 pytest-asyncio,
6 pytestCheckHook,
7 pythonOlder,
8}:
9
10buildPythonPackage rec {
11 pname = "sockio";
12 version = "0.15.0";
13 format = "setuptools";
14
15 disabled = pythonOlder "3.7";
16
17 src = fetchFromGitHub {
18 owner = "tiagocoutinho";
19 repo = pname;
20 rev = "refs/tags/v${version}";
21 hash = "sha256-NSGd7/k1Yr408dipMNBSPRSwQ+wId7VLxgqMM/UmN/Q=";
22 };
23
24 postPatch = ''
25 substituteInPlace setup.cfg \
26 --replace "--cov-config=.coveragerc --cov sockio" "" \
27 --replace "--cov-report html --cov-report term" "" \
28 --replace "--durations=2 --verbose" ""
29 '';
30
31 __darwinAllowLocalNetworking = true;
32
33 nativeCheckInputs = [
34 pytest-asyncio
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}