1{
2 lib,
3 buildPythonPackage,
4 fetchFromGitHub,
5
6 # build-system
7 setuptools,
8
9 # dependencies
10 bitstruct,
11 pyparsing,
12
13 # optional-dependencies
14 prompt-toolkit,
15 diskcache,
16
17 # tests
18 pytest-xdist,
19 pytestCheckHook,
20 versionCheckHook,
21}:
22
23buildPythonPackage rec {
24 pname = "asn1tools";
25 version = "0.167.0";
26 pyproject = true;
27
28 src = fetchFromGitHub {
29 owner = "eerimoq";
30 repo = "asn1tools";
31 tag = version;
32 hash = "sha256-86bdBYlAVJfd3EY8s0t6ZDRA/qZVWuHD4Jxa1n1Ke5E=";
33 };
34
35 build-system = [ setuptools ];
36
37 dependencies = [
38 bitstruct
39 pyparsing
40 ];
41
42 optional-dependencies = {
43 shell = [ prompt-toolkit ];
44 cache = [ diskcache ];
45 };
46
47 nativeCheckInputs = [
48 pytest-xdist
49 pytestCheckHook
50 versionCheckHook
51 ]
52 ++ lib.flatten (builtins.attrValues optional-dependencies);
53 versionCheckProgramArg = "--version";
54
55 pythonImportsCheck = [ "asn1tools" ];
56
57 disabledTests = [
58 # assert exact error message of pyparsing which changed and no longer matches
59 # https://github.com/eerimoq/asn1tools/issues/167
60 "test_parse_error"
61
62 # IndexError: string index out of range
63 # https://github.com/eerimoq/asn1tools/issues/191
64 "test_c_source"
65 "test_command_line_generate_c_source_oer"
66 "test_missing_parameterized_value"
67 "test_parse_parameterization"
68 # SystemExit: error: string index out of range
69 "test_command_line_generate_c_source_uper"
70 "test_command_line_generate_rust_source_uper"
71 ];
72
73 meta = {
74 description = "ASN.1 parsing, encoding and decoding";
75 homepage = "https://github.com/eerimoq/asn1tools";
76 changelog = "https://github.com/eerimoq/asn1tools/releases/tag/${version}";
77 license = lib.licenses.mit;
78 maintainers = [ ];
79 mainProgram = "asn1tools";
80 };
81}