1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
|
{
lib,
stdenv,
buildPythonPackage,
fetchFromGitHub,
future,
hypothesis,
packaging,
parameterized,
msgpack,
pyserial,
pytest-timeout,
pytestCheckHook,
pythonOlder,
setuptools,
typing-extensions,
wrapt,
uptime,
}:
buildPythonPackage rec {
pname = "python-can";
version = "4.4.2";
pyproject = true;
disabled = pythonOlder "3.7";
src = fetchFromGitHub {
owner = "hardbyte";
repo = "python-can";
rev = "refs/tags/v${version}";
hash = "sha256-p3B1LWSygDX0UhIx4XhXv15H7Hwn9UB20jFIPDZnuNs=";
};
postPatch = ''
substituteInPlace tox.ini \
--replace " --cov=can --cov-config=tox.ini --cov-report=lcov --cov-report=term" ""
'';
nativeBuildInputs = [ setuptools ];
propagatedBuildInputs = [
msgpack
packaging
typing-extensions
wrapt
];
passthru.optional-dependencies = {
serial = [ pyserial ];
seeedstudio = [ pyserial ];
pcan = [ uptime ];
};
nativeCheckInputs = [
future
hypothesis
parameterized
pytest-timeout
pytestCheckHook
] ++ passthru.optional-dependencies.serial;
disabledTestPaths = [
# We don't support all interfaces
"test/test_interface_canalystii.py"
];
disabledTests =
[
# Tests require access socket
"BasicTestUdpMulticastBusIPv4"
"BasicTestUdpMulticastBusIPv6"
# pytest.approx is not supported in a boolean context (since pytest7)
"test_pack_unpack"
"test_receive"
]
++ lib.optionals stdenv.hostPlatform.isDarwin [
# timing sensitive
"test_general"
"test_gap"
];
preCheck = ''
export PATH="$PATH:$out/bin";
# skips timing senstive tests
export CI=1
'';
pythonImportsCheck = [ "can" ];
meta = with lib; {
description = "CAN support for Python";
homepage = "https://python-can.readthedocs.io";
changelog = "https://github.com/hardbyte/python-can/releases/tag/v${version}";
license = licenses.lgpl3Only;
maintainers = with maintainers; [
fab
sorki
];
};
}
|