From 7dc7051d4e624f1e110d496426d2464a585e6745 Mon Sep 17 00:00:00 2001 From: elie Date: Mon, 27 Apr 2015 20:01:32 +0000 Subject: optional configuration/MIB directory added to MIB search path (~/,pysnmp/mibs) at MibBuilder --- CHANGES | 2 ++ pysnmp/smi/builder.py | 12 +++++++++++- 2 files changed, 13 insertions(+), 1 deletion(-) diff --git a/CHANGES b/CHANGES index 4d96f03..f2a85a7 100644 --- a/CHANGES +++ b/CHANGES @@ -80,6 +80,8 @@ Revision 4.2.6rc2 - Parts of SMIv1 remnant MIBs (RFC1213-MIB, RFC1158-MIB) added to provide complete compatibility with SMIv1. Symbols defined in these MIBs only present in SMIv1 so they can't be substituted with their SMIv2 analogues. +- Optional configuration/MIB directory added to MIB search path + (~/,pysnmp/mibs) at MibBuilder. - Fix to authoritative engine side snmpEngineID discovery procedure: respond with notInTimeWindows rather then with unsupportedSecurityLevel at time synchronization phase. diff --git a/pysnmp/smi/builder.py b/pysnmp/smi/builder.py index b0f1dd3..610e89d 100644 --- a/pysnmp/smi/builder.py +++ b/pysnmp/smi/builder.py @@ -200,7 +200,17 @@ class MibBuilder: defaultCoreMibs = os.pathsep.join( ('pysnmp.smi.mibs.instances', 'pysnmp.smi.mibs') ) - defaultMiscMibs = 'pysnmp_mibs' + if sys.platform[:3] == 'win': + defaultMiscMibs = os.pathsep.join( + ( os.path.join(os.path.expanduser("~"), + 'PySNMP Configuration', 'mibs'), + 'pysnmp_mibs' ) + ) + else: + defaultMiscMibs = os.pathsep.join( + ( os.path.join(os.path.expanduser("~"), '.pysnmp', 'mibs'), + 'pysnmp_mibs' ) + ) moduleID = 'PYSNMP_MODULE_ID' def __init__(self): self.lastBuildId = self._autoName = 0 -- cgit v1.2.1