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