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