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