1{
2 lib,
3 attrs,
4 buildPythonPackage,
5 click,
6 fetchFromGitHub,
7 ldfparser,
8 lxml,
9 openpyxl,
10 pytest-cov-stub,
11 pytest-timeout,
12 pytestCheckHook,
13 pythonOlder,
14 pyyaml,
15 setuptools,
16 xlrd,
17 xlwt,
18}:
19
20buildPythonPackage rec {
21 pname = "canmatrix";
22 version = "1.2";
23 pyproject = true;
24
25 disabled = pythonOlder "3.9";
26
27 src = fetchFromGitHub {
28 owner = "ebroecker";
29 repo = "canmatrix";
30 tag = version;
31 hash = "sha256-PfegsFha7ernSqnMeaDoLf1jLx1CiOoiYi34dESEgBY=";
32 };
33
34 build-system = [ setuptools ];
35
36 dependencies = [
37 attrs
38 click
39 ];
40
41 optional-dependencies = {
42 arxml = [ lxml ];
43 fibex = [ lxml ];
44 kcd = [ lxml ];
45 ldf = [ ldfparser ];
46 odx = [ lxml ];
47 xls = [
48 xlrd
49 xlwt
50 ];
51 xlsx = [ openpyxl ];
52 yaml = [ pyyaml ];
53 };
54
55 nativeCheckInputs = [
56 pytest-cov-stub
57 pytest-timeout
58 pytestCheckHook
59 ]
60 ++ lib.flatten (builtins.attrValues optional-dependencies);
61
62 pytestFlags = [
63 # long_envvar_name_imports requires stable key value pair ordering
64 "-s"
65 ];
66
67 enabledTestPaths = [
68 "src/canmatrix"
69 "tests/"
70 ];
71
72 disabledTests = [ "long_envvar_name_imports" ];
73
74 pythonImportsCheck = [ "canmatrix" ];
75
76 meta = with lib; {
77 description = "Support and convert several CAN (Controller Area Network) database formats";
78 homepage = "https://github.com/ebroecker/canmatrix";
79 changelog = "https://github.com/ebroecker/canmatrix/releases/tag/${version}";
80 license = licenses.bsd2;
81 maintainers = with maintainers; [ sorki ];
82 };
83}