diff -Nru pysmi-0.2.2/CHANGES.rst pysmi-0.3.2/CHANGES.rst --- pysmi-0.2.2/CHANGES.rst 2017-11-13 00:20:28.000000000 +0000 +++ pysmi-0.3.2/CHANGES.rst 2018-10-22 21:18:37.000000000 +0000 @@ -1,4 +1,35 @@ +Revision 0.3.2, 22-10-2018 +-------------------------- + +- Bumped upper Python version to 3.7 and enabled pip cache +- Exit code indication of the command-line tools aligned with + sysexits.h to report more useful termination status + +Revision 0.3.1, 10-06-2018 +-------------------------- + +- Fixed pysnmp lower version in test-requirements.txt +- Fixed compiler crash when building comments at a platform which + has broken users/groups databases + +Revision 0.3.0, 29-04-2018 +-------------------------- + +- The `mibcopy` tool implemented to copy MIB modules from files with + potentially messed up names into a directory under canonical MIB + names picking up the latest MIB revision along the way. +- ZIP archive reader implemented to pull ASN.1 MIB files from .zip + archives pretty much in the same way as from plain directories +- HTTP/S proxy support added (through respecting `http_proxy` environment + variable) by switching from `httplib` to `urllib2` internally +- Copyright notice bumped up to year 2018 +- Project site in the docs changes from SourceForge to snmplabs.com +- PRODUCT-RELEASE generation added to the JSON code generator +- Added special handling of BITS-like DEFVAL syntax for Integers + that occurs in buggy MIBs +- Fixed missing REVISIONS generations in MODULE-IDENTITY + Revision 0.2.2, 13-11-2017 -------------------------- diff -Nru pysmi-0.2.2/debian/changelog pysmi-0.3.2/debian/changelog --- pysmi-0.2.2/debian/changelog 2017-12-30 15:25:10.000000000 +0000 +++ pysmi-0.3.2/debian/changelog 2018-10-23 19:10:20.000000000 +0000 @@ -1,6 +1,18 @@ +pysmi (0.3.2-1) unstable; urgency=medium + + [ Ondřej Nový ] + * d/control: Set Vcs-* to salsa.debian.org + * Use 'python3 -m sphinx' instead of sphinx-build for building docs + + [ Vincent Bernat ] + * New upstream release + - Fix FTBFS about test MIB not found. Closes: #911692. + * d/rules: don't install mibcopy.py. + + -- Vincent Bernat Tue, 23 Oct 2018 21:10:20 +0200 + pysmi (0.2.2-1) unstable; urgency=low * Initial release (closes: #885863) -- Vincent Bernat Sat, 30 Dec 2017 15:25:10 +0000 - diff -Nru pysmi-0.2.2/debian/control pysmi-0.3.2/debian/control --- pysmi-0.2.2/debian/control 2017-12-30 15:25:10.000000000 +0000 +++ pysmi-0.3.2/debian/control 2018-10-23 19:10:20.000000000 +0000 @@ -11,8 +11,8 @@ python3-sphinx, Standards-Version: 4.1.2 Homepage: https://github.com/etingof/pysmi -Vcs-Git: https://anonscm.debian.org/git/python-modules/packages/pysmi.git -Vcs-Browser: https://anonscm.debian.org/git/python-modules/packages/pysmi.git +Vcs-Git: https://salsa.debian.org/python-team/modules/pysmi.git +Vcs-Browser: https://salsa.debian.org/python-team/modules/pysmi Testsuite: autopkgtest-pkg-python Package: python-pysmi diff -Nru pysmi-0.2.2/debian/python-pysmi.lintian-overrides pysmi-0.3.2/debian/python-pysmi.lintian-overrides --- pysmi-0.2.2/debian/python-pysmi.lintian-overrides 2017-12-30 15:25:10.000000000 +0000 +++ pysmi-0.3.2/debian/python-pysmi.lintian-overrides 1970-01-01 00:00:00.000000000 +0000 @@ -1,2 +0,0 @@ -# Python 2 still exists. Sorry. -python-pysmi: new-package-should-not-package-python2-module diff -Nru pysmi-0.2.2/debian/rules pysmi-0.3.2/debian/rules --- pysmi-0.2.2/debian/rules 2017-12-30 15:25:10.000000000 +0000 +++ pysmi-0.3.2/debian/rules 2018-10-23 19:10:20.000000000 +0000 @@ -6,10 +6,11 @@ override_dh_installdocs: dh_installdocs - PYTHONPATH=. sphinx-build -N -q -E -b html docs/source/ \ + PYTHONPATH=. python3 -m sphinx -N -q -E -b html docs/source/ \ debian/python-pysmi-doc/usr/share/doc/python-pysmi-doc/html/ override_dh_install: dh_install rm -rf debian/python-pysmi/usr/bin mv debian/python3-pysmi/usr/bin/mibdump.py debian/python3-pysmi/usr/bin/mibdump + rm debian/python3-pysmi/usr/bin/mibcopy.py diff -Nru pysmi-0.2.2/devel-requirements.txt pysmi-0.3.2/devel-requirements.txt --- pysmi-0.2.2/devel-requirements.txt 2017-11-13 00:20:28.000000000 +0000 +++ pysmi-0.3.2/devel-requirements.txt 2018-04-24 15:42:02.000000000 +0000 @@ -1,2 +1,3 @@ -sphinx +Sphinx <= 1.6; python_version < '2.7' +Sphinx > 1.6; python_version >= '2.7' pysnmp diff -Nru pysmi-0.2.2/docs/source/conf.py pysmi-0.3.2/docs/source/conf.py --- pysmi-0.2.2/docs/source/conf.py 2017-11-13 00:20:28.000000000 +0000 +++ pysmi-0.3.2/docs/source/conf.py 2018-04-24 15:42:02.000000000 +0000 @@ -53,7 +53,7 @@ # General information about the project. project = u'SNMP SMI compiler' -copyright = u'2015-2017, Ilya Etingof ' +copyright = u'2015-2018, Ilya Etingof ' author = u'Ilya Etingof ' # The version info for the project you're documenting, acts as replacement for diff -Nru pysmi-0.2.2/docs/source/download.rst pysmi-0.3.2/docs/source/download.rst --- pysmi-0.2.2/docs/source/download.rst 2017-11-06 11:10:42.000000000 +0000 +++ pysmi-0.3.2/docs/source/download.rst 2018-04-24 15:42:02.000000000 +0000 @@ -12,4 +12,4 @@ Alternatively, you can download the latest release from `GitHub `_ -or `PyPI `_. +or `PyPI `_. diff -Nru pysmi-0.2.2/docs/source/mibdump.rst pysmi-0.3.2/docs/source/mibdump.rst --- pysmi-0.2.2/docs/source/mibdump.rst 2017-11-13 00:20:28.000000000 +0000 +++ pysmi-0.3.2/docs/source/mibdump.rst 2018-04-24 15:42:02.000000000 +0000 @@ -15,7 +15,7 @@ Synopsis: SNMP SMI/MIB files conversion tool Documentation: - http://pysmi.sourceforge.net + http://snmplabs.com/pysmi Usage: mibdump.py [--help] [--version] [--quiet] diff -Nru pysmi-0.2.2/LICENSE.rst pysmi-0.3.2/LICENSE.rst --- pysmi-0.2.2/LICENSE.rst 2017-01-23 17:13:12.000000000 +0000 +++ pysmi-0.3.2/LICENSE.rst 2018-04-24 15:42:02.000000000 +0000 @@ -1,4 +1,4 @@ -Copyright (c) 2015-2017 Ilya Etingof +Copyright (c) 2015-2018 Ilya Etingof All rights reserved. Redistribution and use in source and binary forms, with or without diff -Nru pysmi-0.2.2/PKG-INFO pysmi-0.3.2/PKG-INFO --- pysmi-0.2.2/PKG-INFO 2017-11-13 00:20:59.000000000 +0000 +++ pysmi-0.3.2/PKG-INFO 2018-10-22 21:20:22.000000000 +0000 @@ -1,6 +1,6 @@ Metadata-Version: 1.1 Name: pysmi -Version: 0.2.2 +Version: 0.3.2 Summary: SNMP SMI/MIB Parser Home-page: https://github.com/etingof/pysmi Author: Ilya Etingof @@ -29,6 +29,7 @@ Classifier: Programming Language :: Python :: 3.4 Classifier: Programming Language :: Python :: 3.5 Classifier: Programming Language :: Python :: 3.6 +Classifier: Programming Language :: Python :: 3.7 Classifier: Topic :: Communications Classifier: Topic :: System :: Monitoring Classifier: Topic :: System :: Networking :: Monitoring diff -Nru pysmi-0.2.2/pysmi/borrower/anyfile.py pysmi-0.3.2/pysmi/borrower/anyfile.py --- pysmi-0.2.2/pysmi/borrower/anyfile.py 2017-11-13 00:20:28.000000000 +0000 +++ pysmi-0.3.2/pysmi/borrower/anyfile.py 2018-04-24 15:42:02.000000000 +0000 @@ -1,8 +1,8 @@ # # This file is part of pysmi software. # -# Copyright (c) 2015-2017, Ilya Etingof -# License: http://pysmi.sf.net/license.html +# Copyright (c) 2015-2018, Ilya Etingof +# License: http://snmplabs.com/pysmi/license.html # from pysmi.borrower.base import AbstractBorrower diff -Nru pysmi-0.2.2/pysmi/borrower/base.py pysmi-0.3.2/pysmi/borrower/base.py --- pysmi-0.2.2/pysmi/borrower/base.py 2017-11-13 00:20:28.000000000 +0000 +++ pysmi-0.3.2/pysmi/borrower/base.py 2018-04-24 15:42:02.000000000 +0000 @@ -1,8 +1,8 @@ # # This file is part of pysmi software. # -# Copyright (c) 2015-2017, Ilya Etingof -# License: http://pysmi.sf.net/license.html +# Copyright (c) 2015-2018, Ilya Etingof +# License: http://snmplabs.com/pysmi/license.html # from pysmi import error from pysmi import debug diff -Nru pysmi-0.2.2/pysmi/borrower/__init__.py pysmi-0.3.2/pysmi/borrower/__init__.py --- pysmi-0.2.2/pysmi/borrower/__init__.py 2017-03-25 02:10:41.000000000 +0000 +++ pysmi-0.3.2/pysmi/borrower/__init__.py 2018-04-24 15:42:02.000000000 +0000 @@ -1,8 +1,8 @@ # # This file is part of pysmi software. # -# Copyright (c) 2015-2017, Ilya Etingof -# License: http://pysmi.sf.net/license.html +# Copyright (c) 2015-2018, Ilya Etingof +# License: http://snmplabs.com/pysmi/license.html # from pysmi.borrower.pyfile import PyFileBorrower from pysmi.borrower.anyfile import AnyFileBorrower diff -Nru pysmi-0.2.2/pysmi/borrower/pyfile.py pysmi-0.3.2/pysmi/borrower/pyfile.py --- pysmi-0.2.2/pysmi/borrower/pyfile.py 2017-11-13 00:20:28.000000000 +0000 +++ pysmi-0.3.2/pysmi/borrower/pyfile.py 2018-04-24 15:42:02.000000000 +0000 @@ -1,8 +1,8 @@ # # This file is part of pysmi software. # -# Copyright (c) 2015-2017, Ilya Etingof -# License: http://pysmi.sf.net/license.html +# Copyright (c) 2015-2018, Ilya Etingof +# License: http://snmplabs.com/pysmi/license.html # import imp from pysmi.borrower.base import AbstractBorrower diff -Nru pysmi-0.2.2/pysmi/codegen/base.py pysmi-0.3.2/pysmi/codegen/base.py --- pysmi-0.2.2/pysmi/codegen/base.py 2017-03-30 23:20:38.000000000 +0000 +++ pysmi-0.3.2/pysmi/codegen/base.py 2018-04-24 15:42:02.000000000 +0000 @@ -1,8 +1,8 @@ # # This file is part of pysmi software. # -# Copyright (c) 2015-2017, Ilya Etingof -# License: http://pysmi.sf.net/license.html +# Copyright (c) 2015-2018, Ilya Etingof +# License: http://snmplabs.com/pysmi/license.html # import sys from pysmi import error diff -Nru pysmi-0.2.2/pysmi/codegen/__init__.py pysmi-0.3.2/pysmi/codegen/__init__.py --- pysmi-0.2.2/pysmi/codegen/__init__.py 2017-03-25 02:10:41.000000000 +0000 +++ pysmi-0.3.2/pysmi/codegen/__init__.py 2018-04-24 15:42:02.000000000 +0000 @@ -1,8 +1,8 @@ # # This file is part of pysmi software. # -# Copyright (c) 2015-2017, Ilya Etingof -# License: http://pysmi.sf.net/license.html +# Copyright (c) 2015-2018, Ilya Etingof +# License: http://snmplabs.com/pysmi/license.html # from pysmi.codegen.pysnmp import PySnmpCodeGen from pysmi.codegen.jsondoc import JsonCodeGen diff -Nru pysmi-0.2.2/pysmi/codegen/jsondoc.py pysmi-0.3.2/pysmi/codegen/jsondoc.py --- pysmi-0.2.2/pysmi/codegen/jsondoc.py 2017-11-11 11:24:06.000000000 +0000 +++ pysmi-0.3.2/pysmi/codegen/jsondoc.py 2018-04-29 08:18:45.000000000 +0000 @@ -1,8 +1,8 @@ # # This file is part of pysmi software. # -# Copyright (c) 2015-2017, Ilya Etingof -# License: http://pysmi.sf.net/license.html +# Copyright (c) 2015-2018, Ilya Etingof +# License: http://snmplabs.com/pysmi/license.html # import sys import re @@ -72,6 +72,7 @@ self._importMap = {} self._out = {} # k, v = name, generated code self._moduleIdentityOid = None + self._moduleRevision = None self._enterpriseOid = None self._oids = set() self._complianceOids = [] @@ -273,6 +274,8 @@ if revisions: outDict['revisions'] = revisions + self._moduleRevision = revisions[0]['revision'] + if self.genRules['text']: if lastUpdated: outDict['lastupdated'] = lastUpdated @@ -633,7 +636,7 @@ else: # symbol (oid as defval) or name for enumeration member if (defvalType[0][0] == 'ObjectIdentifier' and - (defval in self.symbolTable[self.moduleName[0]] or defval in self._importMap)): # oid + (defval in self.symbolTable[self.moduleName[0]] or defval in self._importMap)): # oid module = self._importMap.get(defval, self.moduleName[0]) @@ -645,9 +648,13 @@ raise error.PySmiSemanticError('no symbol "%s" in module "%s"' % (defval, module)) # enumeration - elif (defvalType[0][0] in ('Integer32', 'Integer') and - isinstance(defvalType[1], list) and defval in dict(defvalType[1])): - outDict.update(value=defval, format='enum') + elif defvalType[0][0] in ('Integer32', 'Integer') and isinstance(defvalType[1], list): + if isinstance(defval, list): # buggy MIB: DEFVAL { { ... } } + defval = [dv for dv in defval if dv in dict(defvalType[1])] + if defval: + outDict.update(value=defval[0], format='enum') + elif defval in dict(defvalType[1]): # good MIB: DEFVAL { ... } + outDict.update(value=defval, format='enum') elif defvalType[0][0] == 'Bits': defvalBits = [] @@ -683,6 +690,9 @@ def genStatus(self, data): return data[0] + def genProductRelease(self, data): + return data[0] + def genEnumSpec(self, data): items = data[0] return {'enumeration': dict(items)} @@ -886,7 +896,7 @@ 'trapTypeClause': genTrapType, 'typeDeclaration': genTypeDeclaration, 'valueDeclaration': genValueDeclaration, - + 'PRODUCT-RELEASE': genProductRelease, 'ApplicationSyntax': genSimpleSyntax, 'BitNames': genBitNames, 'BITS': genBits, @@ -957,6 +967,7 @@ return MibInfo(oid=moduleOid, identity=self._moduleIdentityOid, name=self.moduleName[0], + revision=self._moduleRevision, oids=self._oids, enterprise=self._enterpriseOid, compliance=self._complianceOids, diff -Nru pysmi-0.2.2/pysmi/codegen/null.py pysmi-0.3.2/pysmi/codegen/null.py --- pysmi-0.2.2/pysmi/codegen/null.py 2017-01-23 17:13:12.000000000 +0000 +++ pysmi-0.3.2/pysmi/codegen/null.py 2018-04-24 15:42:02.000000000 +0000 @@ -1,8 +1,8 @@ # # This file is part of pysmi software. # -# Copyright (c) 2015-2017, Ilya Etingof -# License: http://pysmi.sf.net/license.html +# Copyright (c) 2015-2018, Ilya Etingof +# License: http://snmplabs.com/pysmi/license.html # from pysmi.mibinfo import MibInfo from pysmi.codegen.base import AbstractCodeGen diff -Nru pysmi-0.2.2/pysmi/codegen/pysnmp.py pysmi-0.3.2/pysmi/codegen/pysnmp.py --- pysmi-0.2.2/pysmi/codegen/pysnmp.py 2017-11-13 00:20:28.000000000 +0000 +++ pysmi-0.3.2/pysmi/codegen/pysnmp.py 2018-04-29 08:18:45.000000000 +0000 @@ -1,8 +1,8 @@ # # This file is part of pysmi software. # -# Copyright (c) 2015-2017, Ilya Etingof -# License: http://pysmi.sf.net/license.html +# Copyright (c) 2015-2018, Ilya Etingof +# License: http://snmplabs.com/pysmi/license.html # import sys import re @@ -116,6 +116,7 @@ self._importMap = {} self._out = {} # k, v = name, generated code self._moduleIdentityOid = None + self._moduleRevision = None self.moduleName = ['DUMMY'] self.genRules = {'text': True} self.symbolTable = {} @@ -340,7 +341,9 @@ outStr = name + ' = ModuleIdentity(' + oidStr + ')' + label + '\n' if revisionsAndDescrs: - revisions, descriptions = revisionsAndDescrs + last_revision, revisions, descriptions = revisionsAndDescrs + + self._moduleRevision = last_revision if revisions: outStr += name + revisions + '\n' @@ -826,10 +829,14 @@ raise error.PySmiSemanticError('no symbol "%s" in module "%s"' % (defval, module)) # enumeration - elif (defvalType[0][0] in ('Integer32', 'Integer') and - isinstance(defvalType[1], list) and - defval in dict(defvalType[1])): - val = dorepr(defval) + elif defvalType[0][0] in ('Integer32', 'Integer') and isinstance(defvalType[1], list): + if isinstance(defval, list): # buggy MIB: DEFVAL { { ... } } + defval = [dv for dv in defval if dv in dict(defvalType[1])] + val = defval and dorepr(defval[0]) or '' + elif defval in dict(defvalType[1]): # good MIB: DEFVAL { ... } + val = dorepr(defval) + else: + val = '' elif defvalType[0][0] == 'Bits': defvalBits = [] @@ -1030,7 +1037,9 @@ [dorepr(self.textFilter('description', x[1][1])) for x in data[0]] ) - return revisions, descriptions + lastRevision = data[0][0][0] + + return lastRevision, revisions, descriptions def genRow(self, data, classmode=False): row = data[0] @@ -1168,7 +1177,7 @@ if 'comments' in kwargs: out = ''.join(['# %s\n' % x for x in kwargs['comments']]) + '#\n' + out - out = '#\n# PySNMP MIB module %s (http://pysnmp.sf.net)\n' % self.moduleName[0] + out + out = '#\n# PySNMP MIB module %s (http://snmplabs.com/pysmi)\n' % self.moduleName[0] + out debug.logger & debug.flagCodegen and debug.logger( 'canonical MIB name %s (%s), imported MIB(s) %s, Python code size %s bytes' % ( @@ -1177,6 +1186,7 @@ return MibInfo(oid=moduleOid, identity=self._moduleIdentityOid, name=self.moduleName[0], + revision=self._moduleRevision, oids=[], enterprise=None, compliance=[], @@ -1194,7 +1204,7 @@ if 'comments' in kwargs: out = ''.join(['# %s\n' % x for x in kwargs['comments']]) + '#\n' + out - out = '#\n# PySNMP MIB indices (http://pysnmp.sf.net)\n' + out + out = '#\n# PySNMP MIB indices (http://snmplabs.com/pysmi)\n' + out debug.logger & debug.flagCodegen and debug.logger( 'OID->MIB index built, %s entries, %s bytes' % (count, len(out))) diff -Nru pysmi-0.2.2/pysmi/codegen/symtable.py pysmi-0.3.2/pysmi/codegen/symtable.py --- pysmi-0.2.2/pysmi/codegen/symtable.py 2017-11-11 11:24:06.000000000 +0000 +++ pysmi-0.3.2/pysmi/codegen/symtable.py 2018-04-29 08:18:45.000000000 +0000 @@ -1,8 +1,8 @@ # # This file is part of pysmi software. # -# Copyright (c) 2015-2017, Ilya Etingof -# License: http://pysmi.sf.net/license.html +# Copyright (c) 2015-2018, Ilya Etingof +# License: http://snmplabs.com/pysmi/license.html # # Build an internally used symbol table for each passed MIB. # @@ -88,6 +88,7 @@ self._symsOrder = [] self._out = {} # k, v = symbol, properties self.moduleName = ['DUMMY'] + self._moduleRevision = None self.genRules = {'text': True} def symTrans(self, symbol): @@ -220,6 +221,9 @@ 'oid': oid, 'origName': origName} + if revisions: + self._moduleRevision = revisions[0] + self.regSym(pysmiName, symProps) # noinspection PyUnusedLocal @@ -491,15 +495,16 @@ # noinspection PyUnusedLocal,PyUnusedLocal,PyMethodMayBeStatic def genLastUpdated(self, data, classmode=False): - return '' + return data[0] # noinspection PyUnusedLocal,PyUnusedLocal,PyMethodMayBeStatic def genOrganization(self, data, classmode=False): - return '' + return data[0] # noinspection PyUnusedLocal,PyUnusedLocal,PyMethodMayBeStatic def genRevisions(self, data, classmode=False): - return '' + lastRevision, lastDescription = data[0][0][0], data[0][0][1][1] + return lastRevision, lastDescription def genRow(self, data, classmode=False): row = data[0] @@ -622,4 +627,7 @@ 'canonical MIB name %s (%s), imported MIB(s) %s, Symbol table size %s symbols' % ( self.moduleName[0], moduleOid, ','.join(importedModules) or '', len(self._out))) - return MibInfo(oid=None, name=self.moduleName[0], imported=tuple([x for x in importedModules])), self._out + return MibInfo(oid=None, + name=self.moduleName[0], + revision=self._moduleRevision, + imported=tuple([x for x in importedModules])), self._out diff -Nru pysmi-0.2.2/pysmi/compat.py pysmi-0.3.2/pysmi/compat.py --- pysmi-0.2.2/pysmi/compat.py 2017-01-23 17:13:12.000000000 +0000 +++ pysmi-0.3.2/pysmi/compat.py 2018-04-24 15:42:02.000000000 +0000 @@ -1,8 +1,8 @@ # # This file is part of pysmi software. # -# Copyright (c) 2015-2017, Ilya Etingof -# License: http://pysmi.sf.net/license.html +# Copyright (c) 2015-2018, Ilya Etingof +# License: http://snmplabs.com/pysmi/license.html # import sys diff -Nru pysmi-0.2.2/pysmi/compiler.py pysmi-0.3.2/pysmi/compiler.py --- pysmi-0.2.2/pysmi/compiler.py 2017-11-13 00:20:28.000000000 +0000 +++ pysmi-0.3.2/pysmi/compiler.py 2018-06-10 14:35:50.000000000 +0000 @@ -1,8 +1,8 @@ # # This file is part of pysmi software. # -# Copyright (c) 2015-2017, Ilya Etingof -# License: http://pysmi.sf.net/license.html +# Copyright (c) 2015-2018, Ilya Etingof +# License: http://snmplabs.com/pysmi/license.html # import sys import os @@ -156,6 +156,22 @@ return self + def _get_system_info(self): + + try: + platform_info = os.uname() + + except AttributeError: + platform_info = ('?',) * 6 + + try: + user_info = getpwuid(os.getuid()) + + except Exception: + user_info = ('?',) * 7 + + return platform_info, user_info + def compile(self, *mibnames, **options): """Transform requested and possibly referred MIBs. @@ -191,6 +207,7 @@ builtMibs = {} symbolTableMap = {} mibsToParse = [x for x in mibnames] + canonicalMibNames = {} while mibsToParse: mibname = mibsToParse.pop(0) @@ -223,6 +240,11 @@ mibsToParse.extend(mibInfo.imported) + if fileInfo.name in mibnames: + if mibInfo.name not in canonicalMibNames: + canonicalMibNames[mibInfo.name] = [] + canonicalMibNames[mibInfo.name].append(fileInfo.name) + debug.logger & debug.flagCompiler and debug.logger( '%s (%s) read from %s, immediate dependencies: %s' % ( mibInfo.name, mibname, fileInfo.path, ', '.join(mibInfo.imported) or '')) @@ -258,7 +280,7 @@ processed[mibname] = statusMissing debug.logger & debug.flagCompiler and debug.logger( - 'MIBs analized %s, MIBs failed %s' % (len(parsedMibs), len(failedMibs))) + 'MIBs analyzed %s, MIBs failed %s' % (len(parsedMibs), len(failedMibs))) # # See what MIBs need generating @@ -297,7 +319,7 @@ debug.logger & debug.flagCompiler and debug.logger( 'no suitable compiled MIB %s found anywhere' % mibname) - if options.get('noDeps') and mibname not in mibnames: + if options.get('noDeps') and mibname not in canonicalMibNames: debug.logger & debug.flagCompiler and debug.logger( 'excluding imported MIB %s from code generation' % mibname) del parsedMibs[mibname] @@ -316,13 +338,13 @@ debug.logger & debug.flagCompiler and debug.logger('compiling %s read from %s' % (mibname, fileInfo.path)) + platform_info, user_info = self._get_system_info() + comments = [ 'ASN.1 source %s' % fileInfo.path, 'Produced by %s-%s at %s' % (packageName, packageVersion, time.asctime()), - 'On host %s platform %s version %s by user %s' % ( - hasattr(os, 'uname') and os.uname()[1] or '?', hasattr(os, 'uname') and os.uname()[0] or '?', - hasattr(os, 'uname') and os.uname()[2] or '?', - hasattr(os, 'getuid') and getpwuid(os.getuid())[0] or '?'), + 'On host %s platform %s version %s by user %s' % (platform_info[1], platform_info[0], + platform_info[2], user_info[0]), 'Using Python version %s' % sys.version.split('\n')[0] ] @@ -362,7 +384,7 @@ # for mibname in failedMibs.copy(): - if options.get('noDeps') and mibname not in mibnames: + if options.get('noDeps') and mibname not in canonicalMibNames: debug.logger & debug.flagCompiler and debug.logger('excluding imported MIB %s from borrowing' % mibname) continue @@ -425,7 +447,7 @@ debug.logger & debug.flagCompiler and debug.logger( 'no suitable compiled MIB %s found anywhere' % mibname) - if options.get('noDeps') and mibname not in mibnames: + if options.get('noDeps') and mibname not in canonicalMibNames: debug.logger & debug.flagCompiler and debug.logger( 'excluding imported MIB %s from borrowing' % mibname) processed[mibname] = statusUntouched @@ -484,6 +506,7 @@ oid=mibInfo.oid, oids=mibInfo.oids, identity=mibInfo.identity, + revision=mibInfo.revision, enterprise=mibInfo.enterprise, compliance=mibInfo.compliance, ) @@ -506,13 +529,15 @@ return processed def buildIndex(self, processedMibs, **options): + platform_info, user_info = self._get_system_info() + comments = [ 'Produced by %s-%s at %s' % (packageName, packageVersion, time.asctime()), - 'On host %s platform %s version %s by user %s' % ( - hasattr(os, 'uname') and os.uname()[1] or '?', hasattr(os, 'uname') and os.uname()[0] or '?', - hasattr(os, 'uname') and os.uname()[2] or '?', hasattr(os, 'getuid') and getpwuid(os.getuid())[0]) or '?', + 'On host %s platform %s version %s by user %s' % (platform_info[1], platform_info[0], + platform_info[2], user_info[0]), 'Using Python version %s' % sys.version.split('\n')[0] ] + try: self._writer.putData( self.indexFile, diff -Nru pysmi-0.2.2/pysmi/debug.py pysmi-0.3.2/pysmi/debug.py --- pysmi-0.2.2/pysmi/debug.py 2017-03-25 13:39:18.000000000 +0000 +++ pysmi-0.3.2/pysmi/debug.py 2018-04-24 15:42:02.000000000 +0000 @@ -1,8 +1,8 @@ # # This file is part of pysmi software. # -# Copyright (c) 2015-2017, Ilya Etingof -# License: http://pysmi.sf.net/license.html +# Copyright (c) 2015-2018, Ilya Etingof +# License: http://snmplabs.com/pysmi/license.html # import logging from pysmi import error diff -Nru pysmi-0.2.2/pysmi/error.py pysmi-0.3.2/pysmi/error.py --- pysmi-0.2.2/pysmi/error.py 2017-01-23 17:13:12.000000000 +0000 +++ pysmi-0.3.2/pysmi/error.py 2018-04-24 15:42:02.000000000 +0000 @@ -1,8 +1,8 @@ # # This file is part of pysmi software. # -# Copyright (c) 2015-2017, Ilya Etingof -# License: http://pysmi.sf.net/license.html +# Copyright (c) 2015-2018, Ilya Etingof +# License: http://snmplabs.com/pysmi/license.html # # Package exception model: # Here we subclass base Python exception overriding its constructor to diff -Nru pysmi-0.2.2/pysmi/__init__.py pysmi-0.3.2/pysmi/__init__.py --- pysmi-0.2.2/pysmi/__init__.py 2017-11-13 00:20:28.000000000 +0000 +++ pysmi-0.3.2/pysmi/__init__.py 2018-08-24 11:46:32.000000000 +0000 @@ -1,5 +1,5 @@ # http://www.python.org/dev/peps/pep-0396/ -__version__ = '0.2.2' +__version__ = '0.3.2' import sys diff -Nru pysmi-0.2.2/pysmi/lexer/base.py pysmi-0.3.2/pysmi/lexer/base.py --- pysmi-0.2.2/pysmi/lexer/base.py 2017-01-23 17:13:12.000000000 +0000 +++ pysmi-0.3.2/pysmi/lexer/base.py 2018-04-24 15:42:02.000000000 +0000 @@ -1,8 +1,8 @@ # # This file is part of pysmi software. # -# Copyright (c) 2015-2017, Ilya Etingof -# License: http://pysmi.sf.net/license.html +# Copyright (c) 2015-2018, Ilya Etingof +# License: http://snmplabs.com/pysmi/license.html # diff -Nru pysmi-0.2.2/pysmi/lexer/__init__.py pysmi-0.3.2/pysmi/lexer/__init__.py --- pysmi-0.2.2/pysmi/lexer/__init__.py 2017-03-25 02:10:41.000000000 +0000 +++ pysmi-0.3.2/pysmi/lexer/__init__.py 2018-04-24 15:42:02.000000000 +0000 @@ -1,7 +1,7 @@ # # This file is part of pysmi software. # -# Copyright (c) 2015-2017, Ilya Etingof -# License: http://pysmi.sf.net/license.html +# Copyright (c) 2015-2018, Ilya Etingof +# License: http://snmplabs.com/pysmi/license.html # from pysmi.lexer.smi import SmiV2Lexer diff -Nru pysmi-0.2.2/pysmi/lexer/smi.py pysmi-0.3.2/pysmi/lexer/smi.py --- pysmi-0.2.2/pysmi/lexer/smi.py 2017-11-03 21:46:25.000000000 +0000 +++ pysmi-0.3.2/pysmi/lexer/smi.py 2018-04-24 15:42:02.000000000 +0000 @@ -1,8 +1,8 @@ # # This file is part of pysmi software. # -# Copyright (c) 2015-2017, Ilya Etingof -# License: http://pysmi.sf.net/license.html +# Copyright (c) 2015-2018, Ilya Etingof +# License: http://snmplabs.com/pysmi/license.html # import sys import re diff -Nru pysmi-0.2.2/pysmi/mibinfo.py pysmi-0.3.2/pysmi/mibinfo.py --- pysmi-0.2.2/pysmi/mibinfo.py 2017-03-25 13:46:26.000000000 +0000 +++ pysmi-0.3.2/pysmi/mibinfo.py 2018-04-29 08:18:45.000000000 +0000 @@ -1,8 +1,8 @@ # # This file is part of pysmi software. # -# Copyright (c) 2015-2017, Ilya Etingof -# License: http://pysmi.sf.net/license.html +# Copyright (c) 2015-2018, Ilya Etingof +# License: http://snmplabs.com/pysmi/license.html # @@ -25,6 +25,9 @@ #: module OID oid = '' + #: MIB revision as `datetime` + revision = None + #: all OIDs defined in this module oids = () diff -Nru pysmi-0.2.2/pysmi/parser/base.py pysmi-0.3.2/pysmi/parser/base.py --- pysmi-0.2.2/pysmi/parser/base.py 2017-01-23 17:13:12.000000000 +0000 +++ pysmi-0.3.2/pysmi/parser/base.py 2018-04-24 15:42:02.000000000 +0000 @@ -1,8 +1,8 @@ # # This file is part of pysmi software. # -# Copyright (c) 2015-2017, Ilya Etingof -# License: http://pysmi.sf.net/license.html +# Copyright (c) 2015-2018, Ilya Etingof +# License: http://snmplabs.com/pysmi/license.html # diff -Nru pysmi-0.2.2/pysmi/parser/dialect.py pysmi-0.3.2/pysmi/parser/dialect.py --- pysmi-0.2.2/pysmi/parser/dialect.py 2017-01-23 17:13:12.000000000 +0000 +++ pysmi-0.3.2/pysmi/parser/dialect.py 2018-04-24 15:42:02.000000000 +0000 @@ -1,8 +1,8 @@ # # This file is part of pysmi software. # -# Copyright (c) 2015-2017, Ilya Etingof -# License: http://pysmi.sf.net/license.html +# Copyright (c) 2015-2018, Ilya Etingof +# License: http://snmplabs.com/pysmi/license.html # # diff -Nru pysmi-0.2.2/pysmi/parser/__init__.py pysmi-0.3.2/pysmi/parser/__init__.py --- pysmi-0.2.2/pysmi/parser/__init__.py 2017-03-25 02:10:41.000000000 +0000 +++ pysmi-0.3.2/pysmi/parser/__init__.py 2018-04-24 15:42:02.000000000 +0000 @@ -1,8 +1,8 @@ # # This file is part of pysmi software. # -# Copyright (c) 2015-2017, Ilya Etingof -# License: http://pysmi.sf.net/license.html +# Copyright (c) 2015-2018, Ilya Etingof +# License: http://snmplabs.com/pysmi/license.html # from pysmi.parser.smiv1 import SmiV1Parser from pysmi.parser.smiv1compat import SmiV1CompatParser, SmiStarParser diff -Nru pysmi-0.2.2/pysmi/parser/null.py pysmi-0.3.2/pysmi/parser/null.py --- pysmi-0.2.2/pysmi/parser/null.py 2017-01-23 17:13:12.000000000 +0000 +++ pysmi-0.3.2/pysmi/parser/null.py 2018-04-24 15:42:02.000000000 +0000 @@ -1,8 +1,8 @@ # # This file is part of pysmi software. # -# Copyright (c) 2015-2017, Ilya Etingof -# License: http://pysmi.sf.net/license.html +# Copyright (c) 2015-2018, Ilya Etingof +# License: http://snmplabs.com/pysmi/license.html # from pysmi.parser.base import AbstractParser diff -Nru pysmi-0.2.2/pysmi/parser/smi.py pysmi-0.3.2/pysmi/parser/smi.py --- pysmi-0.2.2/pysmi/parser/smi.py 2017-11-03 21:46:25.000000000 +0000 +++ pysmi-0.3.2/pysmi/parser/smi.py 2018-04-24 15:42:02.000000000 +0000 @@ -1,8 +1,8 @@ # # This file is part of pysmi software. # -# Copyright (c) 2015-2017, Ilya Etingof -# License: http://pysmi.sf.net/license.html +# Copyright (c) 2015-2018, Ilya Etingof +# License: http://snmplabs.com/pysmi/license.html # import os import sys diff -Nru pysmi-0.2.2/pysmi/parser/smiv1compat.py pysmi-0.3.2/pysmi/parser/smiv1compat.py --- pysmi-0.2.2/pysmi/parser/smiv1compat.py 2017-01-23 17:13:12.000000000 +0000 +++ pysmi-0.3.2/pysmi/parser/smiv1compat.py 2018-04-24 15:42:02.000000000 +0000 @@ -1,8 +1,8 @@ # # This file is part of pysmi software. # -# Copyright (c) 2015-2017, Ilya Etingof -# License: http://pysmi.sf.net/license.html +# Copyright (c) 2015-2018, Ilya Etingof +# License: http://snmplabs.com/pysmi/license.html # from pysmi.parser.smi import parserFactory from pysmi.parser.dialect import smiV1Relaxed diff -Nru pysmi-0.2.2/pysmi/parser/smiv1.py pysmi-0.3.2/pysmi/parser/smiv1.py --- pysmi-0.2.2/pysmi/parser/smiv1.py 2017-01-23 17:13:12.000000000 +0000 +++ pysmi-0.3.2/pysmi/parser/smiv1.py 2018-04-24 15:42:02.000000000 +0000 @@ -1,8 +1,8 @@ # # This file is part of pysmi software. # -# Copyright (c) 2015-2017, Ilya Etingof -# License: http://pysmi.sf.net/license.html +# Copyright (c) 2015-2018, Ilya Etingof +# License: http://snmplabs.com/pysmi/license.html # from pysmi.parser.smi import parserFactory from pysmi.parser.dialect import smiV1 diff -Nru pysmi-0.2.2/pysmi/parser/smiv2.py pysmi-0.3.2/pysmi/parser/smiv2.py --- pysmi-0.2.2/pysmi/parser/smiv2.py 2017-01-23 17:13:12.000000000 +0000 +++ pysmi-0.3.2/pysmi/parser/smiv2.py 2018-04-24 15:42:02.000000000 +0000 @@ -1,8 +1,8 @@ # # This file is part of pysmi software. # -# Copyright (c) 2015-2017, Ilya Etingof -# License: http://pysmi.sf.net/license.html +# Copyright (c) 2015-2018, Ilya Etingof +# License: http://snmplabs.com/pysmi/license.html # from pysmi.parser.smi import parserFactory from pysmi.parser.dialect import smiV2 diff -Nru pysmi-0.2.2/pysmi/reader/base.py pysmi-0.3.2/pysmi/reader/base.py --- pysmi-0.2.2/pysmi/reader/base.py 2017-11-06 11:10:42.000000000 +0000 +++ pysmi-0.3.2/pysmi/reader/base.py 2018-04-24 15:42:02.000000000 +0000 @@ -1,8 +1,8 @@ # # This file is part of pysmi software. # -# Copyright (c) 2015-2017, Ilya Etingof -# License: http://pysmi.sf.net/license.html +# Copyright (c) 2015-2018, Ilya Etingof +# License: http://snmplabs.com/pysmi/license.html # import os diff -Nru pysmi-0.2.2/pysmi/reader/callback.py pysmi-0.3.2/pysmi/reader/callback.py --- pysmi-0.2.2/pysmi/reader/callback.py 2017-11-13 00:20:28.000000000 +0000 +++ pysmi-0.3.2/pysmi/reader/callback.py 2018-04-24 15:42:02.000000000 +0000 @@ -1,8 +1,8 @@ # # This file is part of pysmi software. # -# Copyright (c) 2015-2017, Ilya Etingof -# License: http://pysmi.sf.net/license.html +# Copyright (c) 2015-2018, Ilya Etingof +# License: http://snmplabs.com/pysmi/license.html # import time from pysmi.reader.base import AbstractReader diff -Nru pysmi-0.2.2/pysmi/reader/ftpclient.py pysmi-0.3.2/pysmi/reader/ftpclient.py --- pysmi-0.2.2/pysmi/reader/ftpclient.py 2017-11-13 00:20:28.000000000 +0000 +++ pysmi-0.3.2/pysmi/reader/ftpclient.py 2018-04-24 15:42:02.000000000 +0000 @@ -1,8 +1,8 @@ # # This file is part of pysmi software. # -# Copyright (c) 2015-2017, Ilya Etingof -# License: http://pysmi.sf.net/license.html +# Copyright (c) 2015-2018, Ilya Etingof +# License: http://snmplabs.com/pysmi/license.html # import sys import time diff -Nru pysmi-0.2.2/pysmi/reader/httpclient.py pysmi-0.3.2/pysmi/reader/httpclient.py --- pysmi-0.2.2/pysmi/reader/httpclient.py 2017-11-13 00:20:28.000000000 +0000 +++ pysmi-0.3.2/pysmi/reader/httpclient.py 2018-04-29 08:58:44.000000000 +0000 @@ -1,18 +1,21 @@ # # This file is part of pysmi software. # -# Copyright (c) 2015-2017, Ilya Etingof -# License: http://pysmi.sf.net/license.html +# Copyright (c) 2015-2018, Ilya Etingof +# License: http://snmplabs.com/pysmi/license.html # +import socket import sys import time try: # noinspection PyUnresolvedReferences - import httplib + from urllib2 import Request, urlopen except ImportError: # noinspection PyUnresolvedReferences - import http.client as httplib + from urllib.request import Request + from urllib.request import urlopen + from pysmi.reader.base import AbstractReader from pysmi.mibinfo import MibInfo from pysmi.compat import decode @@ -32,6 +35,10 @@ def __init__(self, host, port, locationTemplate, timeout=5, ssl=False): """Create an instance of *HttpReader* bound to specific URL. + Note: + The `http_proxy` and `https_proxy` environment variables are + respected by the underlying `urllib` stdlib module. + Args: host (str): domain name or IP address of web server port (int): TCP port web server is listening @@ -43,55 +50,47 @@ timeout (int): response timeout ssl (bool): access HTTPS web site """ - self._schema = ssl and 'https' or 'http' - self._host = host - self._port = port - self._locationTemplate = decode(locationTemplate) - self._timeout = timeout + self._url = '%s://%s:%d%s' % (ssl and 'https' or 'http', + host, port, decode(locationTemplate)) + + socket.setdefaulttimeout(timeout) self._user_agent = 'pysmi-%s; python-%s.%s.%s; %s' % ( pysmi_version, sys.version_info[0], sys.version_info[1], sys.version_info[2], sys.platform ) def __str__(self): - return '%s{"%s://%s:%s%s"}' % ( - self.__class__.__name__, self._schema, self._host, self._port, self._locationTemplate) + return self._url def getData(self, mibname): headers = { 'Accept': 'text/plain', 'User-Agent': self._user_agent } - if sys.version_info[:2] < (2, 6): - conn = httplib.HTTPConnection(self._host, self._port) - else: - conn = httplib.HTTPConnection(self._host, self._port, timeout=self._timeout) mibname = decode(mibname) debug.logger & debug.flagReader and debug.logger('looking for MIB %s' % mibname) for mibalias, mibfile in self.getMibVariants(mibname): - if self.MIB_MAGIC in self._locationTemplate: - location = self._locationTemplate.replace(self.MIB_MAGIC, mibfile) + if self.MIB_MAGIC in self._url: + url = self._url.replace(self.MIB_MAGIC, mibfile) else: - location = self._locationTemplate + mibfile + url = self._url + mibfile - debug.logger & debug.flagReader and debug.logger( - 'trying to fetch MIB from %s://%s:%s%s' % (self._schema, self._host, self._port, location)) + debug.logger & debug.flagReader and debug.logger('trying to fetch MIB from %s' % url) try: - conn.request('GET', location, '', headers) - response = conn.getresponse() + req = Request(url, headers=headers) + response = urlopen(req) except Exception: - debug.logger & debug.flagReader and debug.logger('failed to fetch MIB from %s://%s:%s%s: %s' % ( - self._schema, self._host, self._port, location, sys.exc_info()[1])) + debug.logger & debug.flagReader and debug.logger('failed to fetch MIB from %s: %s' % (url, sys.exc_info()[1])) continue - debug.logger & debug.flagReader and debug.logger('HTTP response %s' % response.status) + debug.logger & debug.flagReader and debug.logger('HTTP response %s' % response.code) - if response.status == 200: + if response.code == 200: try: mtime = time.mktime(time.strptime(response.getheader('Last-Modified'), "%a, %d %b %Y %H:%M:%S %Z")) @@ -100,9 +99,8 @@ mtime = time.time() debug.logger & debug.flagReader and debug.logger( - 'fetching source MIB %s, mtime %s' % (location, response.getheader('Last-Modified'))) + 'fetching source MIB %s, mtime %s' % (url, response.getheader('Last-Modified'))) - return MibInfo(path='%s://%s:%s%s' % (self._schema, self._host, self._port, location), file=mibfile, - name=mibalias, mtime=mtime), decode(response.read(self.maxMibSize)) + return MibInfo(path=url, file=mibfile, name=mibalias, mtime=mtime), decode(response.read(self.maxMibSize)) raise error.PySmiReaderFileNotFoundError('source MIB %s not found' % mibname, reader=self) diff -Nru pysmi-0.2.2/pysmi/reader/__init__.py pysmi-0.3.2/pysmi/reader/__init__.py --- pysmi-0.2.2/pysmi/reader/__init__.py 2017-10-12 07:31:47.000000000 +0000 +++ pysmi-0.3.2/pysmi/reader/__init__.py 2018-04-24 15:42:02.000000000 +0000 @@ -1,8 +1,8 @@ # # This file is part of pysmi software. # -# Copyright (c) 2015-2017, Ilya Etingof -# License: http://pysmi.sf.net/license.html +# Copyright (c) 2015-2018, Ilya Etingof +# License: http://snmplabs.com/pysmi/license.html # from pysmi.reader.callback import CallbackReader from pysmi.reader.ftpclient import FtpReader diff -Nru pysmi-0.2.2/pysmi/reader/localfile.py pysmi-0.3.2/pysmi/reader/localfile.py --- pysmi-0.2.2/pysmi/reader/localfile.py 2017-11-13 00:20:28.000000000 +0000 +++ pysmi-0.3.2/pysmi/reader/localfile.py 2018-04-24 15:42:02.000000000 +0000 @@ -1,8 +1,8 @@ # # This file is part of pysmi software. # -# Copyright (c) 2015-2017, Ilya Etingof -# License: http://pysmi.sf.net/license.html +# Copyright (c) 2015-2018, Ilya Etingof +# License: http://snmplabs.com/pysmi/license.html # import os import sys diff -Nru pysmi-0.2.2/pysmi/reader/url.py pysmi-0.3.2/pysmi/reader/url.py --- pysmi-0.2.2/pysmi/reader/url.py 2017-11-03 21:46:25.000000000 +0000 +++ pysmi-0.3.2/pysmi/reader/url.py 2018-04-24 15:42:02.000000000 +0000 @@ -1,8 +1,8 @@ # # This file is part of pysmi software. # -# Copyright (c) 2015-2017, Ilya Etingof -# License: http://pysmi.sf.net/license.html +# Copyright (c) 2015-2018, Ilya Etingof +# License: http://snmplabs.com/pysmi/license.html # import sys diff -Nru pysmi-0.2.2/pysmi/reader/zipreader.py pysmi-0.3.2/pysmi/reader/zipreader.py --- pysmi-0.2.2/pysmi/reader/zipreader.py 2017-11-13 00:20:28.000000000 +0000 +++ pysmi-0.3.2/pysmi/reader/zipreader.py 2018-04-24 15:42:02.000000000 +0000 @@ -1,8 +1,8 @@ # # This file is part of pysmi software. # -# Copyright (c) 2015-2017, Ilya Etingof -# License: http://pysmi.sf.net/license.html +# Copyright (c) 2015-2018, Ilya Etingof +# License: http://snmplabs.com/pysmi/license.html # import os import sys diff -Nru pysmi-0.2.2/pysmi/searcher/anyfile.py pysmi-0.3.2/pysmi/searcher/anyfile.py --- pysmi-0.2.2/pysmi/searcher/anyfile.py 2017-03-25 13:39:18.000000000 +0000 +++ pysmi-0.3.2/pysmi/searcher/anyfile.py 2018-04-24 15:42:02.000000000 +0000 @@ -1,8 +1,8 @@ # # This file is part of pysmi software. # -# Copyright (c) 2015-2017, Ilya Etingof -# License: http://pysmi.sf.net/license.html +# Copyright (c) 2015-2018, Ilya Etingof +# License: http://snmplabs.com/pysmi/license.html # import os import sys diff -Nru pysmi-0.2.2/pysmi/searcher/base.py pysmi-0.3.2/pysmi/searcher/base.py --- pysmi-0.2.2/pysmi/searcher/base.py 2017-01-23 17:13:12.000000000 +0000 +++ pysmi-0.3.2/pysmi/searcher/base.py 2018-04-24 15:42:02.000000000 +0000 @@ -1,8 +1,8 @@ # # This file is part of pysmi software. # -# Copyright (c) 2015-2017, Ilya Etingof -# License: http://pysmi.sf.net/license.html +# Copyright (c) 2015-2018, Ilya Etingof +# License: http://snmplabs.com/pysmi/license.html # diff -Nru pysmi-0.2.2/pysmi/searcher/__init__.py pysmi-0.3.2/pysmi/searcher/__init__.py --- pysmi-0.2.2/pysmi/searcher/__init__.py 2017-03-25 09:20:26.000000000 +0000 +++ pysmi-0.3.2/pysmi/searcher/__init__.py 2018-04-24 15:42:02.000000000 +0000 @@ -1,8 +1,8 @@ # # This file is part of pysmi software. # -# Copyright (c) 2015-2017, Ilya Etingof -# License: http://pysmi.sf.net/license.html +# Copyright (c) 2015-2018, Ilya Etingof +# License: http://snmplabs.com/pysmi/license.html # from pysmi.searcher.pyfile import PyFileSearcher from pysmi.searcher.pypackage import PyPackageSearcher diff -Nru pysmi-0.2.2/pysmi/searcher/pyfile.py pysmi-0.3.2/pysmi/searcher/pyfile.py --- pysmi-0.2.2/pysmi/searcher/pyfile.py 2017-03-25 13:39:18.000000000 +0000 +++ pysmi-0.3.2/pysmi/searcher/pyfile.py 2018-04-24 15:42:02.000000000 +0000 @@ -1,8 +1,8 @@ # # This file is part of pysmi software. # -# Copyright (c) 2015-2017, Ilya Etingof -# License: http://pysmi.sf.net/license.html +# Copyright (c) 2015-2018, Ilya Etingof +# License: http://snmplabs.com/pysmi/license.html # import os import sys diff -Nru pysmi-0.2.2/pysmi/searcher/pypackage.py pysmi-0.3.2/pysmi/searcher/pypackage.py --- pysmi-0.2.2/pysmi/searcher/pypackage.py 2017-03-25 13:39:18.000000000 +0000 +++ pysmi-0.3.2/pysmi/searcher/pypackage.py 2018-04-24 15:42:02.000000000 +0000 @@ -1,8 +1,8 @@ # # This file is part of pysmi software. # -# Copyright (c) 2015-2017, Ilya Etingof -# License: http://pysmi.sf.net/license.html +# Copyright (c) 2015-2018, Ilya Etingof +# License: http://snmplabs.com/pysmi/license.html # import os import time diff -Nru pysmi-0.2.2/pysmi/searcher/stub.py pysmi-0.3.2/pysmi/searcher/stub.py --- pysmi-0.2.2/pysmi/searcher/stub.py 2017-01-23 17:13:12.000000000 +0000 +++ pysmi-0.3.2/pysmi/searcher/stub.py 2018-04-24 15:42:02.000000000 +0000 @@ -1,8 +1,8 @@ # # This file is part of pysmi software. # -# Copyright (c) 2015-2017, Ilya Etingof -# License: http://pysmi.sf.net/license.html +# Copyright (c) 2015-2018, Ilya Etingof +# License: http://snmplabs.com/pysmi/license.html # from pysmi.searcher.base import AbstractSearcher from pysmi import debug diff -Nru pysmi-0.2.2/pysmi/writer/base.py pysmi-0.3.2/pysmi/writer/base.py --- pysmi-0.2.2/pysmi/writer/base.py 2017-01-23 17:13:12.000000000 +0000 +++ pysmi-0.3.2/pysmi/writer/base.py 2018-04-24 15:42:02.000000000 +0000 @@ -1,8 +1,8 @@ # # This file is part of pysmi software. # -# Copyright (c) 2015-2017, Ilya Etingof -# License: http://pysmi.sf.net/license.html +# Copyright (c) 2015-2018, Ilya Etingof +# License: http://snmplabs.com/pysmi/license.html # class AbstractWriter(object): diff -Nru pysmi-0.2.2/pysmi/writer/callback.py pysmi-0.3.2/pysmi/writer/callback.py --- pysmi-0.2.2/pysmi/writer/callback.py 2017-03-25 13:52:07.000000000 +0000 +++ pysmi-0.3.2/pysmi/writer/callback.py 2018-04-24 15:42:02.000000000 +0000 @@ -1,8 +1,8 @@ # # This file is part of pysmi software. # -# Copyright (c) 2015-2017, Ilya Etingof -# License: http://pysmi.sf.net/license.html +# Copyright (c) 2015-2018, Ilya Etingof +# License: http://snmplabs.com/pysmi/license.html # import sys from pysmi.writer.base import AbstractWriter diff -Nru pysmi-0.2.2/pysmi/writer/__init__.py pysmi-0.3.2/pysmi/writer/__init__.py --- pysmi-0.2.2/pysmi/writer/__init__.py 2017-03-25 02:10:41.000000000 +0000 +++ pysmi-0.3.2/pysmi/writer/__init__.py 2018-04-24 15:42:02.000000000 +0000 @@ -1,8 +1,8 @@ # # This file is part of pysmi software. # -# Copyright (c) 2015-2017, Ilya Etingof -# License: http://pysmi.sf.net/license.html +# Copyright (c) 2015-2018, Ilya Etingof +# License: http://snmplabs.com/pysmi/license.html # from pysmi.writer.localfile import FileWriter from pysmi.writer.pyfile import PyFileWriter diff -Nru pysmi-0.2.2/pysmi/writer/localfile.py pysmi-0.3.2/pysmi/writer/localfile.py --- pysmi-0.2.2/pysmi/writer/localfile.py 2017-03-25 13:52:07.000000000 +0000 +++ pysmi-0.3.2/pysmi/writer/localfile.py 2018-04-24 15:42:02.000000000 +0000 @@ -1,8 +1,8 @@ # # This file is part of pysmi software. # -# Copyright (c) 2015-2017, Ilya Etingof -# License: http://pysmi.sf.net/license.html +# Copyright (c) 2015-2018, Ilya Etingof +# License: http://snmplabs.com/pysmi/license.html # import os import sys diff -Nru pysmi-0.2.2/pysmi/writer/pyfile.py pysmi-0.3.2/pysmi/writer/pyfile.py --- pysmi-0.2.2/pysmi/writer/pyfile.py 2017-03-25 13:39:18.000000000 +0000 +++ pysmi-0.3.2/pysmi/writer/pyfile.py 2018-04-24 15:42:02.000000000 +0000 @@ -1,8 +1,8 @@ # # This file is part of pysmi software. # -# Copyright (c) 2015-2017, Ilya Etingof -# License: http://pysmi.sf.net/license.html +# Copyright (c) 2015-2018, Ilya Etingof +# License: http://snmplabs.com/pysmi/license.html # import os import sys diff -Nru pysmi-0.2.2/pysmi.egg-info/PKG-INFO pysmi-0.3.2/pysmi.egg-info/PKG-INFO --- pysmi-0.2.2/pysmi.egg-info/PKG-INFO 2017-11-13 00:20:59.000000000 +0000 +++ pysmi-0.3.2/pysmi.egg-info/PKG-INFO 2018-10-22 21:20:22.000000000 +0000 @@ -1,6 +1,6 @@ Metadata-Version: 1.1 Name: pysmi -Version: 0.2.2 +Version: 0.3.2 Summary: SNMP SMI/MIB Parser Home-page: https://github.com/etingof/pysmi Author: Ilya Etingof @@ -29,6 +29,7 @@ Classifier: Programming Language :: Python :: 3.4 Classifier: Programming Language :: Python :: 3.5 Classifier: Programming Language :: Python :: 3.6 +Classifier: Programming Language :: Python :: 3.7 Classifier: Topic :: Communications Classifier: Topic :: System :: Monitoring Classifier: Topic :: System :: Networking :: Monitoring diff -Nru pysmi-0.2.2/pysmi.egg-info/SOURCES.txt pysmi-0.3.2/pysmi.egg-info/SOURCES.txt --- pysmi-0.2.2/pysmi.egg-info/SOURCES.txt 2017-11-13 00:20:59.000000000 +0000 +++ pysmi-0.3.2/pysmi.egg-info/SOURCES.txt 2018-10-22 21:20:22.000000000 +0000 @@ -8,6 +8,7 @@ requirements.txt setup.cfg setup.py +test-requirements.txt docs/Makefile docs/README.txt docs/source/changelog.rst @@ -103,6 +104,7 @@ pysmi/writer/callback.py pysmi/writer/localfile.py pysmi/writer/pyfile.py +scripts/mibcopy.py scripts/mibdump.py tests/__init__.py tests/__main__.py diff -Nru pysmi-0.2.2/README.md pysmi-0.3.2/README.md --- pysmi-0.2.2/README.md 2017-11-06 11:10:42.000000000 +0000 +++ pysmi-0.3.2/README.md 2018-08-24 11:46:32.000000000 +0000 @@ -1,7 +1,7 @@ SNMP MIB parser --------------- -[![Python Versions](https://img.shields.io/pypi/pyversions/pysmi.svg)](https://pypi.python.org/pypi/pysmi/) +[![Python Versions](https://img.shields.io/pypi/pyversions/pysmi.svg)](https://pypi.org/project/pysmi/) [![Build status](https://travis-ci.org/etingof/pysmi.svg?branch=master)](https://secure.travis-ci.org/etingof/pysmi) [![Coverage Status](https://img.shields.io/codecov/c/github/etingof/pysmi.svg)](https://codecov.io/github/etingof/pysmi) [![GitHub license](https://img.shields.io/badge/license-BSD-blue.svg)](https://raw.githubusercontent.com/etingof/pysmi/master/LICENSE.rst) @@ -20,9 +20,9 @@ * Maintains an index of MIB objects over many MIB modules * Automatically pulls ASN.1 MIBs from local directories, ZIP archives, HTTP and FTP servers -* 100% Python, works with Python 2.4 up to Python 3.6 +* 100% Python, works with Python 2.4 up to Python 3.7 -Rendered PySMI documentation can be found at [pysmi site](http://pysmi.sf.net). +Rendered PySMI documentation can be found at [pysmi site](http://snmplabs.com/pysmi). How to use PySMI ---------------- @@ -186,14 +186,14 @@ ---------------- The pysmi package is distributed under terms and conditions of 2-clause -BSD [license](http://pyasn1.sourceforge.net/license.html). Source code is freely +BSD [license](http://snmplabs.com/pysmi/license.html). Source code is freely available as a GitHub [repo](https://github.com/etingof/pysmi). -You could `pip install pysmi` or download it from [PyPI](https://pypi.python.org/pypi/pysmi). +You could `pip install pysmi` or download it from [PyPI](https://pypi.org/project/pysmi/). If something does not work as expected, [open an issue](https://github.com/etingof/pysmi/issues) at GitHub or post your question [on Stack Overflow](http://stackoverflow.com/questions/ask). -Copyright (c) 2015-2017, [Ilya Etingof](mailto:etingof@gmail.com). +Copyright (c) 2015-2018, [Ilya Etingof](mailto:etingof@gmail.com). All rights reserved. diff -Nru pysmi-0.2.2/scripts/mibcopy.py pysmi-0.3.2/scripts/mibcopy.py --- pysmi-0.2.2/scripts/mibcopy.py 1970-01-01 00:00:00.000000000 +0000 +++ pysmi-0.3.2/scripts/mibcopy.py 2018-10-22 21:17:55.000000000 +0000 @@ -0,0 +1,285 @@ +#!/usr/bin/env python +# +# This file is part of pysmi software. +# +# Copyright (c) 2015-2018, Ilya Etingof +# License: http://snmplabs.com/pysmi/license.html +# +# SNMP SMI/MIB copying tool +# +import os +import sys +import getopt +import shutil +from datetime import datetime +from pysmi.reader import FileReader, getReadersFromUrls +from pysmi.writer import CallbackWriter +from pysmi.parser import SmiV1CompatParser +from pysmi.codegen import JsonCodeGen +from pysmi.compiler import MibCompiler +from pysmi import debug +from pysmi import error + +# sysexits.h +EX_OK = 0 +EX_USAGE = 64 +EX_SOFTWARE = 70 + +# Defaults +quietFlag = False +verboseFlag = False +mibSources = [] +dstDirectory = None +cacheDirectory = '' +dryrunFlag = False +ignoreErrorsFlag = False + +helpMessage = """\ +Usage: %s [--help] + [--version] + [--verbose] + [--quiet] + [--debug=<%s>] + [--mib-source=] + [--cache-directory=] + [--ignore-errors] + [--dry-run] + +Where: + URI - file, zip, http, https, ftp, sftp schemes are supported. + Use @mib@ placeholder token in URI to refer directly to + the required MIB module when source does not support + directory listing (e.g. HTTP). +""" % ( + sys.argv[0], + '|'.join([x for x in sorted(debug.flagMap)]) +) + +# TODO(etingof): add the option to copy MIBs into enterprise-indexed subdirs + +try: + opts, inputMibs = getopt.getopt( + sys.argv[1:], 'hv', + ['help', 'version', 'verbose', 'quiet', 'debug=', + 'mib-source=', 'mib-stub=', + 'cache-directory=', 'ignore-errors', 'dry-run'] + ) + +except getopt.GetoptError: + sys.exit(EX_USAGE) + +for opt in opts: + if opt[0] == '-h' or opt[0] == '--help': + sys.stderr.write("""\ +Synopsis: + SNMP SMI/MIB files copying tool. When given MIB file(s) or directory(ies) + on input and a destination directory, the tool parses MIBs to figure out + their canonical MIB module name and the latest revision date, then + copies MIB module on input into the destination directory under its + MIB module name *if* there is no such file already or its revision date + is older. + +Documentation: + http://snmplabs.com/pysmi +%s +""" % helpMessage) + sys.exit(EX_OK) + + if opt[0] == '-v' or opt[0] == '--version': + from pysmi import __version__ + + sys.stderr.write("""\ +SNMP SMI/MIB library version %s, written by Ilya Etingof +Python interpreter: %s +Software documentation and support at http://snmplabs.com/pysmi +%s +""" % (__version__, sys.version, helpMessage)) + sys.exit(EX_OK) + + if opt[0] == '--quiet': + quietFlag = True + + if opt[0] == '--verbose': + verboseFlag = True + + if opt[0] == '--debug': + debug.setLogger(debug.Debug(*opt[1].split(','))) + + if opt[0] == '--mib-source': + mibSources.append(opt[1]) + + if opt[0] == '--cache-directory': + cacheDirectory = opt[1] + + if opt[0] == '--ignore-errors': + ignoreErrorsFlag = True + +if not mibSources: + mibSources = ['file:///usr/share/snmp/mibs', + 'http://mibs.snmplabs.com/asn1/@mib@'] + +if len(inputMibs) < 2: + sys.stderr.write('ERROR: MIB source and/or destination arguments not given\r\n%s\r\n' % helpMessage) + sys.exit(EX_USAGE) + +dstDirectory = inputMibs.pop() + +if os.path.exists(dstDirectory) and not os.path.isdir(dstDirectory): + sys.stderr.write('ERROR: given destination is not a directory\r\n%s\r\n' % helpMessage) + sys.exit(EX_USAGE) + +try: + os.makedirs(dstDirectory, mode=0o755) + +except OSError: + pass + +# Compiler infrastructure + +codeGenerator = JsonCodeGen() + +mibParser = SmiV1CompatParser(tempdir=cacheDirectory) + +fileWriter = CallbackWriter(lambda *x: None) + + +def getMibRevision(mibDir, mibFile): + + mibCompiler = MibCompiler( + mibParser, + codeGenerator, + fileWriter + ) + + mibCompiler.addSources( + FileReader(mibDir, recursive=False, ignoreErrors=ignoreErrorsFlag), + *getReadersFromUrls(*mibSources) + ) + + try: + processed = mibCompiler.compile( + mibFile, **dict(noDeps=True, rebuild=True, fuzzyMatching=False, ignoreErrors=ignoreErrorsFlag) + ) + + except error.PySmiError: + sys.stderr.write('ERROR: %s\r\n' % sys.exc_info()[1]) + sys.exit(EX_SOFTWARE) + + for canonicalMibName in processed: + if (processed[canonicalMibName] == 'compiled' and + processed[canonicalMibName].path == 'file://' + os.path.join(mibDir, mibFile)): + + try: + revision = datetime.strptime(processed[canonicalMibName].revision, '%Y-%m-%d %H:%M') + + except Exception: + revision = datetime.fromtimestamp(0) + + return canonicalMibName, revision + + raise error.PySmiError('Can\'t read or parse MIB "%s"' % os.path.join(mibDir, mibFile)) + + +def shortenPath(path, maxLength=45): + if len(path) > maxLength: + return '...' + path[-maxLength:] + else: + return path + +mibsSeen = mibsCopied = mibsFailed = 0 + +mibsRevisions = {} + +for srcDirectory in inputMibs: + + if verboseFlag: + sys.stderr.write('Reading "%s"...\r\n' % srcDirectory) + + if os.path.isfile(srcDirectory): + mibFiles = [(os.path.abspath(os.path.dirname(srcDirectory)), os.path.basename(srcDirectory))] + + else: + mibFiles = [(os.path.abspath(dirName), mibFile) + for dirName, _, mibFiles in os.walk(srcDirectory) + for mibFile in mibFiles] + + for srcDirectory, mibFile in mibFiles: + + mibsSeen += 1 + + # TODO(etingof): also check module OID to make sure there is no name collision + + try: + mibName, srcMibRevision = getMibRevision(srcDirectory, mibFile) + + except error.PySmiError as ex: + if verboseFlag: + sys.stderr.write('Failed to read source MIB "%s": %s\r\n' % (os.path.join(srcDirectory, mibFile), ex)) + + if not quietFlag: + sys.stderr.write('FAILED %s\r\n' % shortenPath(os.path.join(srcDirectory, mibFile))) + + mibsFailed +=1 + + continue + + if mibName in mibsRevisions: + dstMibRevision = mibsRevisions[mibName] + + else: + try: + _, dstMibRevision = getMibRevision(dstDirectory, mibName) + + except error.PySmiError as ex: + if verboseFlag: + sys.stderr.write('MIB "%s" is not available at the ' + 'destination directory "%s": %s\r\n' % (os.path.join(srcDirectory, mibFile), + dstDirectory, ex)) + + dstMibRevision = datetime.fromtimestamp(0) + + mibsRevisions[mibName] = dstMibRevision + + if dstMibRevision >= srcMibRevision: + if verboseFlag: + sys.stderr.write('Destination MIB "%s" has the same or newer revision as the ' + 'source MIB "%s"\r\n' % (os.path.join(dstDirectory, mibName), + os.path.join(srcDirectory, mibFile))) + if not quietFlag: + sys.stderr.write('NOT COPIED %s (%s)\r\n' % ( + shortenPath(os.path.join(srcDirectory, mibFile)), mibName)) + + continue + + mibsRevisions[mibName] = srcMibRevision + + if verboseFlag: + sys.stderr.write('Copying "%s" (revision "%s") -> "%s" (revision "%s")\r\n' % ( + os.path.join(srcDirectory, mibFile), srcMibRevision, + os.path.join(dstDirectory, mibName), dstMibRevision)) + + try: + shutil.copy(os.path.join(srcDirectory, mibFile), os.path.join(dstDirectory, mibName)) + + except Exception as ex: + if verboseFlag: + sys.stderr.write('Failed to copy MIB "%s" -> "%s" (%s): "%s"\r\n' % ( + os.path.join(srcDirectory, mibFile), os.path.join(dstDirectory, mibName), mibName, ex)) + + if not quietFlag: + sys.stderr.write('FAILED %s (%s)\r\n' % ( + shortenPath(os.path.join(srcDirectory, mibFile)), mibName)) + + mibsFailed += 1 + + else: + if not quietFlag: + sys.stderr.write('COPIED %s (%s)\r\n' % ( + shortenPath(os.path.join(srcDirectory, mibFile)), mibName)) + + mibsCopied +=1 + +if not quietFlag: + sys.stderr.write("MIBs seen: %d, copied: %d, failed: %d\r\n" % (mibsSeen, mibsCopied, mibsFailed)) + +sys.exit(EX_OK) diff -Nru pysmi-0.2.2/scripts/mibdump.py pysmi-0.3.2/scripts/mibdump.py --- pysmi-0.2.2/scripts/mibdump.py 2017-11-06 11:10:42.000000000 +0000 +++ pysmi-0.3.2/scripts/mibdump.py 2018-10-22 21:17:55.000000000 +0000 @@ -2,8 +2,8 @@ # # This file is part of pysmi software. # -# Copyright (c) 2015-2017, Ilya Etingof -# License: http://pysmi.sf.net/license.html +# Copyright (c) 2015-2018, Ilya Etingof +# License: http://snmplabs.com/pysmi/license.html # # SNMP SMI/MIB data management tool # @@ -20,6 +20,13 @@ from pysmi import debug from pysmi import error +# sysexits.h +EX_OK = 0 +EX_USAGE = 64 +EX_SOFTWARE = 70 +EX_MIB_MISSING = 79 +EX_MIB_FAILED = 79 + # Defaults verboseFlag = True mibSources = [] @@ -90,7 +97,7 @@ if verboseFlag: sys.stderr.write('ERROR: %s\r\n%s\r\n' % (sys.exc_info()[1], helpMessage)) - sys.exit(1) + sys.exit(EX_USAGE) for opt in opts: if opt[0] == '-h' or opt[0] == '--help': @@ -98,10 +105,10 @@ Synopsis: SNMP SMI/MIB files conversion tool Documentation: - http://pysmi.sourceforge.net + http://snmplabs.com/pysmi %s """ % helpMessage) - sys.exit(-1) + sys.exit(EX_OK) if opt[0] == '-v' or opt[0] == '--version': from pysmi import __version__ @@ -109,10 +116,10 @@ sys.stderr.write("""\ SNMP SMI/MIB library version %s, written by Ilya Etingof Python interpreter: %s -Software documentation and support at http://pysmi.sf.net +Software documentation and support at http://snmplabs.com/pysmi %s """ % (__version__, sys.version, helpMessage)) - sys.exit(1) + sys.exit(EX_OK) if opt[0] == '--quiet': verboseFlag = False @@ -153,7 +160,7 @@ except ValueError: sys.stderr.write('ERROR: known Python optimization levels: -1, 0, 1, 2\r\n%s\r\n' % helpMessage) - sys.exit(-1) + sys.exit(EX_USAGE) if opt[0] == '--ignore-errors': ignoreErrorsFlag = True @@ -194,7 +201,7 @@ if not inputMibs: sys.stderr.write('ERROR: MIB modules names not specified\r\n%s\r\n' % helpMessage) - sys.exit(-1) + sys.exit(EX_USAGE) if not dstFormat: dstFormat = 'pysnmp' @@ -280,7 +287,7 @@ else: sys.stderr.write('ERROR: unknown destination format: %s\r\n%s\r\n' % (dstFormat, helpMessage)) - sys.exit(-1) + sys.exit(EX_USAGE) if verboseFlag: sys.stderr.write("""Source MIB repositories: %s @@ -359,7 +366,7 @@ except error.PySmiError: sys.stderr.write('ERROR: %s\r\n' % sys.exc_info()[1]) - sys.exit(-1) + sys.exit(EX_SOFTWARE) else: if verboseFlag: @@ -381,4 +388,12 @@ sys.stderr.write('Failed MIBs: %s\r\n' % ', '.join( ['%s (%s)' % (x, processed[x].error) for x in sorted(processed) if processed[x] == 'failed'])) - sys.exit(0) + exitCode = EX_OK + + if any(x for x in processed.values() if x == 'missing'): + exitCode = EX_MIB_MISSING + + if any(x for x in processed.values() if x == 'failed'): + exitCode = EX_MIB_FAILED + + sys.exit(exitCode) diff -Nru pysmi-0.2.2/setup.cfg pysmi-0.3.2/setup.cfg --- pysmi-0.2.2/setup.cfg 2017-11-13 00:20:59.000000000 +0000 +++ pysmi-0.3.2/setup.cfg 2018-10-22 21:20:22.000000000 +0000 @@ -1,6 +1,9 @@ [bdist_wheel] universal = 1 +[metadata] +license_file = LICENSE.rst + [egg_info] tag_build = tag_date = 0 diff -Nru pysmi-0.2.2/setup.py pysmi-0.3.2/setup.py --- pysmi-0.2.2/setup.py 2017-08-15 20:53:52.000000000 +0000 +++ pysmi-0.3.2/setup.py 2018-08-24 11:46:32.000000000 +0000 @@ -2,12 +2,13 @@ # # This file is part of pysmi software. # -# Copyright (c) 2015-2017, Ilya Etingof -# License: http://pysmi.sf.net/license.html +# Copyright (c) 2015-2018, Ilya Etingof +# License: http://snmplabs.com/pysmi/license.html # """SNMP SMI/MIB Parser - A pure-Python implementation of SNMP/SMI MIB parsing and conversion library. +A pure-Python implementation of SNMP/SMI MIB parsing and +conversion library. """ import os @@ -35,6 +36,7 @@ Programming Language :: Python :: 3.4 Programming Language :: Python :: 3.5 Programming Language :: Python :: 3.6 +Programming Language :: Python :: 3.7 Topic :: Communications Topic :: System :: Monitoring Topic :: System :: Networking :: Monitoring @@ -113,7 +115,8 @@ 'pysmi.codegen', 'pysmi.borrower', 'pysmi.writer'], - 'scripts': [os.path.join('scripts', 'mibdump.py')] + 'scripts': [os.path.join('scripts', 'mibdump.py'), + os.path.join('scripts', 'mibcopy.py')] }) # handle unittest discovery feature diff -Nru pysmi-0.2.2/test-requirements.txt pysmi-0.3.2/test-requirements.txt --- pysmi-0.2.2/test-requirements.txt 1970-01-01 00:00:00.000000000 +0000 +++ pysmi-0.3.2/test-requirements.txt 2018-06-10 14:35:50.000000000 +0000 @@ -0,0 +1 @@ +pysnmp>=4.3.10 diff -Nru pysmi-0.2.2/tests/__main__.py pysmi-0.3.2/tests/__main__.py --- pysmi-0.2.2/tests/__main__.py 2017-10-12 07:31:47.000000000 +0000 +++ pysmi-0.3.2/tests/__main__.py 2018-04-24 15:42:02.000000000 +0000 @@ -1,8 +1,8 @@ # # This file is part of pysmi software. # -# Copyright (c) 2015-2017, Ilya Etingof -# License: http://pysmi.sf.net/license.html +# Copyright (c) 2015-2018, Ilya Etingof +# License: http://snmplabs.com/pysmi/license.html # try: import unittest2 as unittest diff -Nru pysmi-0.2.2/tests/test_agentcapabilities_smiv2_pysnmp.py pysmi-0.3.2/tests/test_agentcapabilities_smiv2_pysnmp.py --- pysmi-0.2.2/tests/test_agentcapabilities_smiv2_pysnmp.py 2017-03-29 18:31:29.000000000 +0000 +++ pysmi-0.3.2/tests/test_agentcapabilities_smiv2_pysnmp.py 2018-04-24 15:42:02.000000000 +0000 @@ -1,8 +1,8 @@ # # This file is part of pysmi software. # -# Copyright (c) 2015-2017, Ilya Etingof -# License: http://pysmi.sf.net/license.html +# Copyright (c) 2015-2018, Ilya Etingof +# License: http://snmplabs.com/pysmi/license.html # import sys try: diff -Nru pysmi-0.2.2/tests/test_imports_smiv2_pysnmp.py pysmi-0.3.2/tests/test_imports_smiv2_pysnmp.py --- pysmi-0.2.2/tests/test_imports_smiv2_pysnmp.py 2017-03-29 18:31:35.000000000 +0000 +++ pysmi-0.3.2/tests/test_imports_smiv2_pysnmp.py 2018-04-24 15:42:02.000000000 +0000 @@ -1,8 +1,8 @@ # # This file is part of pysmi software. # -# Copyright (c) 2015-2017, Ilya Etingof -# License: http://pysmi.sf.net/license.html +# Copyright (c) 2015-2018, Ilya Etingof +# License: http://snmplabs.com/pysmi/license.html # import sys try: diff -Nru pysmi-0.2.2/tests/test_modulecompliance_smiv2_pysnmp.py pysmi-0.3.2/tests/test_modulecompliance_smiv2_pysnmp.py --- pysmi-0.2.2/tests/test_modulecompliance_smiv2_pysnmp.py 2017-03-29 18:31:39.000000000 +0000 +++ pysmi-0.3.2/tests/test_modulecompliance_smiv2_pysnmp.py 2018-04-24 15:42:02.000000000 +0000 @@ -1,8 +1,8 @@ # # This file is part of pysmi software. # -# Copyright (c) 2015-2017, Ilya Etingof -# License: http://pysmi.sf.net/license.html +# Copyright (c) 2015-2018, Ilya Etingof +# License: http://snmplabs.com/pysmi/license.html # import sys try: diff -Nru pysmi-0.2.2/tests/test_moduleidentity_smiv2_pysnmp.py pysmi-0.3.2/tests/test_moduleidentity_smiv2_pysnmp.py --- pysmi-0.2.2/tests/test_moduleidentity_smiv2_pysnmp.py 2017-04-12 22:46:10.000000000 +0000 +++ pysmi-0.3.2/tests/test_moduleidentity_smiv2_pysnmp.py 2018-04-24 15:42:02.000000000 +0000 @@ -1,8 +1,8 @@ # # This file is part of pysmi software. # -# Copyright (c) 2015-2017, Ilya Etingof -# License: http://pysmi.sf.net/license.html +# Copyright (c) 2015-2018, Ilya Etingof +# License: http://snmplabs.com/pysmi/license.html # import sys try: diff -Nru pysmi-0.2.2/tests/test_notificationgroup_smiv2_pysnmp.py pysmi-0.3.2/tests/test_notificationgroup_smiv2_pysnmp.py --- pysmi-0.2.2/tests/test_notificationgroup_smiv2_pysnmp.py 2017-03-29 18:31:47.000000000 +0000 +++ pysmi-0.3.2/tests/test_notificationgroup_smiv2_pysnmp.py 2018-04-24 15:42:02.000000000 +0000 @@ -1,8 +1,8 @@ # # This file is part of pysmi software. # -# Copyright (c) 2015-2017, Ilya Etingof -# License: http://pysmi.sf.net/license.html +# Copyright (c) 2015-2018, Ilya Etingof +# License: http://snmplabs.com/pysmi/license.html # import sys try: diff -Nru pysmi-0.2.2/tests/test_notificationtype_smiv2_pysnmp.py pysmi-0.3.2/tests/test_notificationtype_smiv2_pysnmp.py --- pysmi-0.2.2/tests/test_notificationtype_smiv2_pysnmp.py 2017-03-29 18:31:51.000000000 +0000 +++ pysmi-0.3.2/tests/test_notificationtype_smiv2_pysnmp.py 2018-04-24 15:42:02.000000000 +0000 @@ -1,8 +1,8 @@ # # This file is part of pysmi software. # -# Copyright (c) 2015-2017, Ilya Etingof -# License: http://pysmi.sf.net/license.html +# Copyright (c) 2015-2018, Ilya Etingof +# License: http://snmplabs.com/pysmi/license.html # import sys try: diff -Nru pysmi-0.2.2/tests/test_objectgroup_smiv2_pysnmp.py pysmi-0.3.2/tests/test_objectgroup_smiv2_pysnmp.py --- pysmi-0.2.2/tests/test_objectgroup_smiv2_pysnmp.py 2017-03-29 18:31:56.000000000 +0000 +++ pysmi-0.3.2/tests/test_objectgroup_smiv2_pysnmp.py 2018-04-24 15:42:02.000000000 +0000 @@ -1,8 +1,8 @@ # # This file is part of pysmi software. # -# Copyright (c) 2015-2017, Ilya Etingof -# License: http://pysmi.sf.net/license.html +# Copyright (c) 2015-2018, Ilya Etingof +# License: http://snmplabs.com/pysmi/license.html # import sys try: diff -Nru pysmi-0.2.2/tests/test_objectidentity_smiv2_pysnmp.py pysmi-0.3.2/tests/test_objectidentity_smiv2_pysnmp.py --- pysmi-0.2.2/tests/test_objectidentity_smiv2_pysnmp.py 2017-03-29 18:32:00.000000000 +0000 +++ pysmi-0.3.2/tests/test_objectidentity_smiv2_pysnmp.py 2018-04-24 15:42:02.000000000 +0000 @@ -1,8 +1,8 @@ # # This file is part of pysmi software. # -# Copyright (c) 2015-2017, Ilya Etingof -# License: http://pysmi.sf.net/license.html +# Copyright (c) 2015-2018, Ilya Etingof +# License: http://snmplabs.com/pysmi/license.html # import sys try: diff -Nru pysmi-0.2.2/tests/test_objecttype_smiv2_pysnmp.py pysmi-0.3.2/tests/test_objecttype_smiv2_pysnmp.py --- pysmi-0.2.2/tests/test_objecttype_smiv2_pysnmp.py 2017-03-29 18:32:40.000000000 +0000 +++ pysmi-0.3.2/tests/test_objecttype_smiv2_pysnmp.py 2018-04-24 15:42:02.000000000 +0000 @@ -1,8 +1,8 @@ # # This file is part of pysmi software. # -# Copyright (c) 2015-2017, Ilya Etingof -# License: http://pysmi.sf.net/license.html +# Copyright (c) 2015-2018, Ilya Etingof +# License: http://snmplabs.com/pysmi/license.html # import sys try: diff -Nru pysmi-0.2.2/tests/test_smiv1_smiv2_pysnmp.py pysmi-0.3.2/tests/test_smiv1_smiv2_pysnmp.py --- pysmi-0.2.2/tests/test_smiv1_smiv2_pysnmp.py 2017-03-29 18:32:45.000000000 +0000 +++ pysmi-0.3.2/tests/test_smiv1_smiv2_pysnmp.py 2018-04-24 15:42:02.000000000 +0000 @@ -1,8 +1,8 @@ # # This file is part of pysmi software. # -# Copyright (c) 2015-2017, Ilya Etingof -# License: http://pysmi.sf.net/license.html +# Copyright (c) 2015-2018, Ilya Etingof +# License: http://snmplabs.com/pysmi/license.html # import sys try: diff -Nru pysmi-0.2.2/tests/test_traptype_smiv2_pysnmp.py pysmi-0.3.2/tests/test_traptype_smiv2_pysnmp.py --- pysmi-0.2.2/tests/test_traptype_smiv2_pysnmp.py 2017-03-29 18:32:48.000000000 +0000 +++ pysmi-0.3.2/tests/test_traptype_smiv2_pysnmp.py 2018-04-24 15:42:02.000000000 +0000 @@ -1,8 +1,8 @@ # # This file is part of pysmi software. # -# Copyright (c) 2015-2017, Ilya Etingof -# License: http://pysmi.sf.net/license.html +# Copyright (c) 2015-2018, Ilya Etingof +# License: http://snmplabs.com/pysmi/license.html # import sys try: diff -Nru pysmi-0.2.2/tests/test_typedeclaration_smiv1_pysnmp.py pysmi-0.3.2/tests/test_typedeclaration_smiv1_pysnmp.py --- pysmi-0.2.2/tests/test_typedeclaration_smiv1_pysnmp.py 2017-03-30 09:04:52.000000000 +0000 +++ pysmi-0.3.2/tests/test_typedeclaration_smiv1_pysnmp.py 2018-04-24 15:42:02.000000000 +0000 @@ -1,8 +1,8 @@ # # This file is part of pysmi software. # -# Copyright (c) 2015-2017, Ilya Etingof -# License: http://pysmi.sf.net/license.html +# Copyright (c) 2015-2018, Ilya Etingof +# License: http://snmplabs.com/pysmi/license.html # import sys try: diff -Nru pysmi-0.2.2/tests/test_typedeclaration_smiv2_pysnmp.py pysmi-0.3.2/tests/test_typedeclaration_smiv2_pysnmp.py --- pysmi-0.2.2/tests/test_typedeclaration_smiv2_pysnmp.py 2017-03-30 09:04:52.000000000 +0000 +++ pysmi-0.3.2/tests/test_typedeclaration_smiv2_pysnmp.py 2018-04-24 15:42:02.000000000 +0000 @@ -1,8 +1,8 @@ # # This file is part of pysmi software. # -# Copyright (c) 2015-2017, Ilya Etingof -# License: http://pysmi.sf.net/license.html +# Copyright (c) 2015-2018, Ilya Etingof +# License: http://snmplabs.com/pysmi/license.html # import sys try: diff -Nru pysmi-0.2.2/tests/test_valuedeclaration_smiv2_pysnmp.py pysmi-0.3.2/tests/test_valuedeclaration_smiv2_pysnmp.py --- pysmi-0.2.2/tests/test_valuedeclaration_smiv2_pysnmp.py 2017-03-29 18:32:59.000000000 +0000 +++ pysmi-0.3.2/tests/test_valuedeclaration_smiv2_pysnmp.py 2018-04-24 15:42:02.000000000 +0000 @@ -1,8 +1,8 @@ # # This file is part of pysmi software. # -# Copyright (c) 2015-2017, Ilya Etingof -# License: http://pysmi.sf.net/license.html +# Copyright (c) 2015-2018, Ilya Etingof +# License: http://snmplabs.com/pysmi/license.html # import sys try: diff -Nru pysmi-0.2.2/tests/test_zipreader.py pysmi-0.3.2/tests/test_zipreader.py --- pysmi-0.2.2/tests/test_zipreader.py 2017-10-12 07:31:47.000000000 +0000 +++ pysmi-0.3.2/tests/test_zipreader.py 2018-04-24 15:42:02.000000000 +0000 @@ -1,8 +1,8 @@ # # This file is part of pysmi software. # -# Copyright (c) 2015-2017, Ilya Etingof -# License: http://pysmi.sf.net/license.html +# Copyright (c) 2015-2018, Ilya Etingof +# License: http://snmplabs.com/pysmi/license.html # import sys import os @@ -170,6 +170,8 @@ def testGetDataFromFile(self): + filename = None + try: fd, filename = tempfile.mkstemp() os.write(fd, self.zipContents) @@ -181,14 +183,18 @@ assert data == 'A\n' - finally: + except Exception: + pass + + if filename: try: os.remove(filename) - except: + except Exception: pass def testGetInnerZipData(self): + filename = None try: fd, filename = tempfile.mkstemp() @@ -201,14 +207,16 @@ assert data == 'C\n' - finally: + except Exception: + pass + + if filename: try: os.remove(filename) - except: + except Exception: pass - suite = unittest.TestLoader().loadTestsFromModule(sys.modules[__name__]) if __name__ == '__main__':