1{
2 lib,
3 buildPythonPackage,
4 fetchFromGitHub,
5
6 # build-system
7 poetry-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.16";
23 pyproject = true;
24
25 src = fetchFromGitHub {
26 owner = "lextudio";
27 repo = "pysnmp";
28 tag = "v${version}";
29 hash = "sha256-HGIbxvq4twyZavtjkf2Uu9SEFIXzPCT34lAJEeprwXU=";
30 };
31
32 build-system = [ poetry-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 ];
75
76 disabledTestPaths = [
77 # MIB file "CISCO-ENHANCED-IPSEC-FLOW-MIB.py[co]" not found in search path
78 "tests/smi/manager/test_mib-tree-inspection.py"
79 ];
80
81 pythonImportsCheck = [ "pysnmp" ];
82
83 meta = with lib; {
84 description = "Python SNMP library";
85 homepage = "https://github.com/lextudio/pysnmp";
86 changelog = "https://github.com/lextudio/pysnmp/blob/${src.rev}/CHANGES.rst";
87 license = licenses.bsd2;
88 maintainers = with maintainers; [ hexa ];
89 };
90}