1{
2 lib,
3 buildPythonPackage,
4 fetchFromGitHub,
5
6 # build-system
7 flit-core,
8
9 # dependencies
10 pyasn1,
11 pysmi,
12 pysnmpcrypto,
13
14 # tests
15 pytestCheckHook,
16 pytest-asyncio,
17 pytest-cov-stub,
18}:
19
20buildPythonPackage rec {
21 pname = "pysnmp";
22 version = "7.1.21";
23 pyproject = true;
24
25 src = fetchFromGitHub {
26 owner = "lextudio";
27 repo = "pysnmp";
28 tag = "v${version}";
29 hash = "sha256-IbVs/fjNRDhp4a78ZbgqUOxyrlZjEwsKSlQV3+mmCjo=";
30 };
31
32 build-system = [ flit-core ];
33
34 dependencies = [
35 pyasn1
36 pysmi
37 pysnmpcrypto
38 ];
39
40 nativeCheckInputs = [
41 pytestCheckHook
42 pytest-asyncio
43 pytest-cov-stub
44 ];
45
46 disabledTests = [
47 # Temporary failure in name resolution
48 "test_custom_asn1_mib_search_path"
49 "test_send_notification"
50 "test_send_trap"
51 "test_send_v3_inform_notification"
52 "test_send_v3_inform_sync"
53 "test_usm_sha_aes128"
54 "test_v1_get"
55 "test_v1_next"
56 "test_v1_set"
57 # pysnmp.error.PySnmpError: Bad IPv4/UDP transport address demo.pysnmp.com@161: [Errno -3] Temporary failure in name resolution
58 "test_v2c_bulk"
59 "test_v2c_get_table_bulk"
60 "test_v2c_get_table_bulk_0_7"
61 "test_v2c_get_table_bulk_0_8"
62 "test_v2c_get_table_bulk_0_31"
63 "test_v2c_get_table_bulk_0_60"
64 "test_v2c_get_table_bulk_0_5_subtree"
65 "test_v2c_get_table_bulk_0_6_subtree"
66 # pysnmp.smi.error.MibNotFoundError
67 "test_send_v3_trap_notification"
68 "test_addAsn1MibSource"
69 "test_v1_walk"
70 "test_v2_walk"
71 "test_syntax_integer"
72 "test_syntax_unsigned"
73 "test_add_asn1_mib_source"
74 "test_syntax_fixed_length_octet_string"
75 ];
76
77 disabledTestPaths = [
78 # MIB file "CISCO-ENHANCED-IPSEC-FLOW-MIB.py[co]" not found in search path
79 "tests/smi/manager/test_mib-tree-inspection.py"
80 ];
81
82 pythonImportsCheck = [ "pysnmp" ];
83
84 meta = with lib; {
85 description = "Python SNMP library";
86 homepage = "https://github.com/lextudio/pysnmp";
87 changelog = "https://github.com/lextudio/pysnmp/blob/${src.rev}/CHANGES.rst";
88 license = licenses.bsd2;
89 maintainers = with maintainers; [ hexa ];
90 };
91}