Clone of https://github.com/NixOS/nixpkgs.git (to stress-test knotserver)
at gcc-offload 91 lines 2.3 kB view raw
1{ 2 lib, 3 buildPythonPackage, 4 fetchFromGitHub, 5 pythonOlder, 6 python-can, 7 cobs, 8 libpcap, 9 nunavut, 10 numpy, 11 pyserial, 12 pytestCheckHook, 13 pytest-asyncio, 14}: 15 16buildPythonPackage rec { 17 pname = "pycyphal"; 18 version = "1.18.0"; 19 format = "setuptools"; 20 21 disabled = pythonOlder "3.8"; 22 23 src = fetchFromGitHub { 24 owner = "OpenCyphal"; 25 repo = pname; 26 rev = "refs/tags/${version}"; 27 hash = "sha256-XkH0wss8ueh/Wwz0lhvQShOp3a4X9lNdosT/sMe7p4Q="; 28 fetchSubmodules = true; 29 }; 30 31 propagatedBuildInputs = [ 32 numpy 33 nunavut 34 ]; 35 36 optional-dependencies = { 37 transport-can-pythoncan = [ python-can ] ++ python-can.optional-dependencies.serial; 38 transport-serial = [ 39 cobs 40 pyserial 41 ]; 42 transport-udp = [ libpcap ]; 43 }; 44 45 nativeCheckInputs = [ 46 pytestCheckHook 47 pytest-asyncio 48 ] ++ builtins.foldl' (x: y: x ++ y) [ ] (builtins.attrValues optional-dependencies); 49 50 preCheck = '' 51 export HOME=$TMPDIR 52 export PYTHONASYNCIODEBUG=1 53 python -c ${lib.escapeShellArg '' 54 import pycyphal 55 pycyphal.dsdl.compile_all( 56 [ 57 "demo/public_regulated_data_types/uavcan", 58 "demo/custom_data_types/sirius_cyber_corp", 59 ], 60 output_directory=".dsdl_compiled", 61 ) 62 ''} 63 export PYTHONPATH="$(pwd)/.dsdl_compiled:$PYTHONPATH" 64 ''; 65 66 # These require extra permissions and/or actual hardware connected 67 disabledTestPaths = [ 68 "pycyphal/application/__init__.py" 69 "pycyphal/application/_transport_factory.py" 70 "pycyphal/transport/udp/_ip/_link_layer.py" 71 "pycyphal/transport/udp/_ip/_v4.py" 72 "tests/application" 73 "tests/demo" 74 "tests/dsdl" 75 "tests/presentation" 76 "tests/transport" 77 ]; 78 79 pythonImportsCheck = [ "pycyphal" ]; 80 81 meta = with lib; { 82 description = "Full-featured implementation of the Cyphal protocol stack in Python"; 83 longDescription = '' 84 Cyphal is an open technology for real-time intravehicular distributed computing and communication based on modern networking standards (Ethernet, CAN FD, etc.). 85 ''; 86 homepage = "https://opencyphal.org/"; 87 changelog = "https://github.com/OpenCyphal/pycyphal/blob/${version}/CHANGELOG.rst"; 88 license = licenses.mit; 89 maintainers = teams.ororatech.members; 90 }; 91}