Skip to content

Commit

Permalink
fix to mibdump.py --destination-directory handling
Browse files Browse the repository at this point in the history
  • Loading branch information
etingof committed May 6, 2017
1 parent 2683b24 commit d15dc61
Show file tree
Hide file tree
Showing 3 changed files with 15 additions and 9 deletions.
3 changes: 2 additions & 1 deletion CHANGES.rst
Original file line number Diff line number Diff line change
@@ -1,9 +1,10 @@

Revision 0.1.3, XX-04-2017
Revision 0.1.3, XX-05-2017
--------------------------

* INET-ADDRESS-MIB configured as pre-built at pysnmp codegen
* JSON codegen produces "nodetype" element for OBJECT-TYPE
* Fix to mibdump.py --destination-directory option

Revision 0.1.2, 12-04-2017
--------------------------
Expand Down
3 changes: 2 additions & 1 deletion pysmi/codegen/pysnmp.py
Original file line number Diff line number Diff line change
Expand Up @@ -71,7 +71,8 @@ class PySnmpCodeGen(AbstractCodeGen):
fakeMibs = ('ASN1',
'ASN1-ENUMERATION',
'ASN1-REFINEMENT')
baseMibs = ('SNMP-FRAMEWORK-MIB',
baseMibs = ('PYSNMP-USM-MIB',
'SNMP-FRAMEWORK-MIB',
'SNMP-TARGET-MIB',
'TRANSPORT-ADDRESS-MIB',
'INET-ADDRESS-MIB') + AbstractCodeGen.baseMibs
Expand Down
18 changes: 11 additions & 7 deletions scripts/mibdump.py
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,7 @@
mibStubs = []
mibBorrowers = []
dstFormat = None
dstDirectory = None
cacheDirectory = ''
nodepsFlag = False
rebuildFlag = False
Expand Down Expand Up @@ -205,11 +206,12 @@
mibBorrowers = [('http://mibs.snmplabs.com/pysnmp/notexts/@mib@', False),
('http://mibs.snmplabs.com/pysnmp/fulltexts/@mib@', True)]

dstDirectory = os.path.expanduser("~")
if sys.platform[:3] == 'win':
dstDirectory = os.path.join(dstDirectory, 'PySNMP Configuration', 'mibs')
else:
dstDirectory = os.path.join(dstDirectory, '.pysnmp', 'mibs')
if not dstDirectory:
dstDirectory = os.path.expanduser("~")
if sys.platform[:3] == 'win':
dstDirectory = os.path.join(dstDirectory, 'PySNMP Configuration', 'mibs')
else:
dstDirectory = os.path.join(dstDirectory, '.pysnmp', 'mibs')

# Compiler infrastructure

Expand All @@ -236,7 +238,8 @@
mibBorrowers = [('http://mibs.snmplabs.com/json/notexts/@mib@', False),
('http://mibs.snmplabs.com/json/fulltexts/@mib@', True)]

dstDirectory = os.path.join('.')
if not dstDirectory:
dstDirectory = os.path.join('.')

# Compiler infrastructure

Expand All @@ -257,7 +260,8 @@
mibBorrowers = [('http://mibs.snmplabs.com/null/notexts/@mib@', False),
('http://mibs.snmplabs.com/null/fulltexts/@mib@', True)]

dstDirectory = ''
if not dstDirectory:
dstDirectory = ''

# Compiler infrastructure

Expand Down

0 comments on commit d15dc61

Please sign in to comment.