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