From 108841c3e592362bc56a7355651bc3698b9adaf8 Mon Sep 17 00:00:00 2001 From: elie Date: Mon, 29 Jun 2015 21:01:32 +0000 Subject: provide public attributes even if pysmi not available --- pysnmp/smi/compiler.py | 19 ++++++++++--------- 1 file changed, 10 insertions(+), 9 deletions(-) diff --git a/pysnmp/smi/compiler.py b/pysnmp/smi/compiler.py index e8f31dc..4efb224 100644 --- a/pysnmp/smi/compiler.py +++ b/pysnmp/smi/compiler.py @@ -5,6 +5,16 @@ import os import sys +defaultSources = [ 'file:///usr/share/snmp/mibs' ] + +if sys.platform[:3] == 'win': + defaultDest = os.path.join(os.path.expanduser("~"), + 'PySNMP Configuration', 'mibs') +else: + defaultDest = os.path.join(os.path.expanduser("~"), '.pysnmp', 'mibs') + +defaultBorrowers = [] + try: from pysmi.reader.url import getReadersFromUrls from pysmi.searcher.pypackage import PyPackageSearcher @@ -26,15 +36,6 @@ except ImportError: raise error.SmiError('MIB compiler not available (pysmi not installed)') else: - defaultSources = [ 'file:///usr/share/snmp/mibs' ] - - if sys.platform[:3] == 'win': - defaultDest = os.path.join(os.path.expanduser("~"), - 'PySNMP Configuration', 'mibs') - else: - defaultDest = os.path.join(os.path.expanduser("~"), '.pysnmp', 'mibs') - - defaultBorrowers = [] def addMibCompiler(mibBuilder, sources=defaultSources, -- cgit v1.2.1