1{ lib
2, buildPythonPackage
3, fetchFromGitHub
4, future
5, hypothesis
6, packaging
7, parameterized
8, msgpack
9, pyserial
10, pytest-timeout
11, pytestCheckHook
12, pythonOlder
13, typing-extensions
14, wrapt
15}:
16
17buildPythonPackage rec {
18 pname = "python-can";
19 version = "4.0.0";
20 format = "setuptools";
21
22 disabled = pythonOlder "3.6";
23
24 src = fetchFromGitHub {
25 owner = "hardbyte";
26 repo = pname;
27 rev = version;
28 hash = "sha256-/z7zBfVbO7x4UtzWOXolH2YrtYWgsvRLObWwz8sqOEc=";
29 };
30
31 propagatedBuildInputs = [
32 msgpack
33 packaging
34 pyserial
35 typing-extensions
36 wrapt
37 ];
38
39 checkInputs = [
40 future
41 hypothesis
42 parameterized
43 pytest-timeout
44 pytestCheckHook
45 ];
46
47 postPatch = ''
48 substituteInPlace tox.ini \
49 --replace " --cov=can --cov-config=tox.ini --cov-report=xml --cov-report=term" ""
50 '';
51
52 disabledTestPaths = [
53 # We don't support all interfaces
54 "test/test_interface_canalystii.py"
55 ];
56
57 disabledTests = [
58 # Tests require access socket
59 "BasicTestUdpMulticastBusIPv4"
60 "BasicTestUdpMulticastBusIPv6"
61 # pytest.approx is not supported in a boolean context (since pytest7)
62 "test_pack_unpack"
63 "test_receive"
64 ];
65
66 preCheck = ''
67 export PATH="$PATH:$out/bin";
68 '';
69
70 pythonImportsCheck = [
71 "can"
72 ];
73
74 meta = with lib; {
75 description = "CAN support for Python";
76 homepage = "https://python-can.readthedocs.io";
77 license = licenses.lgpl3Only;
78 maintainers = with maintainers; [ fab sorki ];
79 };
80}