1{ lib
2, buildPythonPackage
3, fetchFromGitHub
4, pythonOlder
5, wrapt
6, typing
7, pyserial
8, nose
9, mock
10, hypothesis
11, future
12, pytest
13, pytest-timeout }:
14
15buildPythonPackage rec {
16 pname = "python-can";
17 version = "3.1.0";
18
19 # PyPI tarball is missing some tests and is missing __init__.py in test
20 # directory causing the tests to fail. See:
21 # https://github.com/hardbyte/python-can/issues/518
22 src = fetchFromGitHub {
23 repo = pname;
24 owner = "hardbyte";
25 rev = "v${version}";
26 sha256 = "01lfsh7drm4qvv909x9i0vnhskdh27mcb5xa86sv9m3zfpq8cjis";
27 };
28
29 propagatedBuildInputs = [ wrapt pyserial ] ++ lib.optional (pythonOlder "3.5") typing;
30 checkInputs = [ nose mock pytest pytest-timeout hypothesis future ];
31
32 # Add the scripts to PATH
33 checkPhase = ''
34 PATH=$out/bin:$PATH pytest -c /dev/null
35 '';
36
37 meta = with lib; {
38 homepage = https://github.com/hardbyte/python-can;
39 description = "CAN support for Python";
40 license = licenses.lgpl3;
41 maintainers = with maintainers; [ sorki ];
42 };
43}