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 ] ++ lib.flatten (builtins.attrValues optional-dependencies);
52 versionCheckProgramArg = "--version";
53
54 pythonImportsCheck = [ "asn1tools" ];
55
56 disabledTests = [
57 # assert exact error message of pyparsing which changed and no longer matches
58 # https://github.com/eerimoq/asn1tools/issues/167
59 "test_parse_error"
60
61 # IndexError: string index out of range
62 # https://github.com/eerimoq/asn1tools/issues/191
63 "test_c_source"
64 "test_command_line_generate_c_source_oer"
65 "test_missing_parameterized_value"
66 "test_parse_parameterization"
67 # SystemExit: error: string index out of range
68 "test_command_line_generate_c_source_uper"
69 "test_command_line_generate_rust_source_uper"
70 ];
71
72 meta = {
73 description = "ASN.1 parsing, encoding and decoding";
74 homepage = "https://github.com/eerimoq/asn1tools";
75 changelog = "https://github.com/eerimoq/asn1tools/releases/tag/${version}";
76 license = lib.licenses.mit;
77 maintainers = [ ];
78 mainProgram = "asn1tools";
79 };
80}