2020-04-24 23:36:52 +00:00
|
|
|
{ lib
|
|
|
|
, buildPythonPackage
|
2022-01-19 23:45:15 +00:00
|
|
|
, fetchFromGitHub
|
|
|
|
, future
|
|
|
|
, hypothesis
|
2022-04-27 09:35:20 +00:00
|
|
|
, packaging
|
2022-01-19 23:45:15 +00:00
|
|
|
, parameterized
|
|
|
|
, msgpack
|
|
|
|
, pyserial
|
|
|
|
, pytest-timeout
|
|
|
|
, pytestCheckHook
|
2020-04-24 23:36:52 +00:00
|
|
|
, pythonOlder
|
2023-03-15 16:39:30 +00:00
|
|
|
, setuptools
|
|
|
|
, stdenv
|
2022-01-19 23:45:15 +00:00
|
|
|
, typing-extensions
|
2020-04-24 23:36:52 +00:00
|
|
|
, wrapt
|
2022-12-02 08:20:57 +00:00
|
|
|
, uptime
|
2022-01-19 23:45:15 +00:00
|
|
|
}:
|
2020-04-24 23:36:52 +00:00
|
|
|
|
|
|
|
buildPythonPackage rec {
|
2022-12-02 08:20:57 +00:00
|
|
|
pname = "can";
|
|
|
|
version = "4.1.0";
|
2022-01-19 23:45:15 +00:00
|
|
|
format = "setuptools";
|
|
|
|
|
2022-12-02 08:20:57 +00:00
|
|
|
disabled = pythonOlder "3.7";
|
2020-04-24 23:36:52 +00:00
|
|
|
|
2022-01-19 23:45:15 +00:00
|
|
|
src = fetchFromGitHub {
|
|
|
|
owner = "hardbyte";
|
2022-12-02 08:20:57 +00:00
|
|
|
repo = "python-can";
|
|
|
|
rev = "refs/tags/v${version}";
|
|
|
|
hash = "sha256-jNy47SapujTF3ReJtIbwUY53IftIH4cXZjkzHrnZMFQ=";
|
2020-04-24 23:36:52 +00:00
|
|
|
};
|
|
|
|
|
2022-12-02 08:20:57 +00:00
|
|
|
postPatch = ''
|
|
|
|
substituteInPlace tox.ini \
|
|
|
|
--replace " --cov=can --cov-config=tox.ini --cov-report=lcov --cov-report=term" ""
|
|
|
|
'';
|
|
|
|
|
2022-01-19 23:45:15 +00:00
|
|
|
propagatedBuildInputs = [
|
|
|
|
msgpack
|
2022-04-27 09:35:20 +00:00
|
|
|
packaging
|
2023-03-15 16:39:30 +00:00
|
|
|
setuptools
|
2022-01-19 23:45:15 +00:00
|
|
|
typing-extensions
|
|
|
|
wrapt
|
|
|
|
];
|
2020-04-24 23:36:52 +00:00
|
|
|
|
2022-12-02 08:20:57 +00:00
|
|
|
passthru.optional-dependencies = {
|
|
|
|
serial = [
|
|
|
|
pyserial
|
|
|
|
];
|
|
|
|
seeedstudio = [
|
|
|
|
pyserial
|
|
|
|
];
|
|
|
|
pcan = [
|
|
|
|
uptime
|
|
|
|
];
|
|
|
|
};
|
|
|
|
|
2023-02-02 18:25:31 +00:00
|
|
|
nativeCheckInputs = [
|
2022-01-19 23:45:15 +00:00
|
|
|
future
|
|
|
|
hypothesis
|
|
|
|
parameterized
|
|
|
|
pytest-timeout
|
|
|
|
pytestCheckHook
|
2022-12-02 08:20:57 +00:00
|
|
|
] ++ passthru.optional-dependencies.serial;
|
2022-01-19 23:45:15 +00:00
|
|
|
|
|
|
|
disabledTestPaths = [
|
|
|
|
# We don't support all interfaces
|
|
|
|
"test/test_interface_canalystii.py"
|
|
|
|
];
|
|
|
|
|
|
|
|
disabledTests = [
|
|
|
|
# Tests require access socket
|
|
|
|
"BasicTestUdpMulticastBusIPv4"
|
|
|
|
"BasicTestUdpMulticastBusIPv6"
|
2022-04-15 01:41:22 +00:00
|
|
|
# pytest.approx is not supported in a boolean context (since pytest7)
|
|
|
|
"test_pack_unpack"
|
|
|
|
"test_receive"
|
2023-03-15 16:39:30 +00:00
|
|
|
] ++ lib.optionals stdenv.isDarwin [
|
|
|
|
# timing sensitive
|
|
|
|
"test_general"
|
|
|
|
"test_gap"
|
2022-01-19 23:45:15 +00:00
|
|
|
];
|
|
|
|
|
|
|
|
preCheck = ''
|
|
|
|
export PATH="$PATH:$out/bin";
|
2023-03-15 16:39:30 +00:00
|
|
|
# skips timing senstive tests
|
|
|
|
export CI=1
|
2020-04-24 23:36:52 +00:00
|
|
|
'';
|
|
|
|
|
2022-01-19 23:45:15 +00:00
|
|
|
pythonImportsCheck = [
|
|
|
|
"can"
|
|
|
|
];
|
|
|
|
|
2020-04-24 23:36:52 +00:00
|
|
|
meta = with lib; {
|
|
|
|
description = "CAN support for Python";
|
2022-04-27 09:35:20 +00:00
|
|
|
homepage = "https://python-can.readthedocs.io";
|
2022-12-02 08:20:57 +00:00
|
|
|
changelog = "https://github.com/hardbyte/python-can/releases/tag/v${version}";
|
2022-01-19 23:45:15 +00:00
|
|
|
license = licenses.lgpl3Only;
|
|
|
|
maintainers = with maintainers; [ fab sorki ];
|
2020-04-24 23:36:52 +00:00
|
|
|
};
|
|
|
|
}
|