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 __darwinAllowLocalNetworking = true;
31
32 nativeCheckInputs = [
33 pytest-asyncio
34 pytestCheckHook
35 ];
36
37 pythonImportsCheck = [
38 "sockio"
39 ];
40
41 disabledTests = [
42 # Tests require network access
43 "test_open_timeout"
44 "test_write_readline_error"
45 "test_open_close"
46 "test_callbacks"
47 "test_coroutine_callbacks"
48 "test_error_callback"
49 "test_eof_callback"
50 "test_write_read"
51 "test_write_readline"
52 "test_write_readlines"
53 "test_writelines_readlines"
54 "test_writelines"
55 "test_readline"
56 "test_readuntil"
57 "test_readexactly"
58 "test_readlines"
59 "test_read"
60 "test_readbuffer"
61 "test_parallel_rw"
62 "test_parallel"
63 "test_stream"
64 "test_timeout"
65 "test_line_stream"
66 "test_block_stream"
67 "test_socket_for_url"
68 "test_root_socket_for_url"
69 ];
70
71 disabledTestPaths = [
72 # We don't care about Python 2.x
73 "tests/test_py2.py"
74 ];
75
76 meta = with lib; {
77 description = "Implementation of the Modbus protocol";
78 homepage = "https://tiagocoutinho.github.io/sockio/";
79 license = with licenses; [ gpl3Plus ];
80 maintainers = with maintainers; [ fab ];
81 };
82}