Hello community,

here is the log from the commit of package python-pysmi for openSUSE:Factory 
checked in at 2019-05-07 23:18:37
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Comparing /work/SRC/openSUSE:Factory/python-pysmi (Old)
 and      /work/SRC/openSUSE:Factory/.python-pysmi.new.5148 (New)
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++

Package is "python-pysmi"

Tue May  7 23:18:37 2019 rev:6 rq:701110 version:0.3.4

Changes:
--------
--- /work/SRC/openSUSE:Factory/python-pysmi/python-pysmi.changes        
2019-01-21 10:49:22.428091081 +0100
+++ /work/SRC/openSUSE:Factory/.python-pysmi.new.5148/python-pysmi.changes      
2019-05-07 23:18:40.132881737 +0200
@@ -1,0 +2,8 @@
+Mon May  6 13:46:05 UTC 2019 - [email protected]
+
+- version update to 0.3.4
+  - Rebased MIB importing code onto `importlib` because `imp` is long
+    deprecated
+  - Fixed Py file borrower to become functional
+
+-------------------------------------------------------------------

Old:
----
  pysmi-0.3.3.tar.gz

New:
----
  pysmi-0.3.4.tar.gz

++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++

Other differences:
------------------
++++++ python-pysmi.spec ++++++
--- /var/tmp/diff_new_pack.Z4skTI/_old  2019-05-07 23:18:40.580882679 +0200
+++ /var/tmp/diff_new_pack.Z4skTI/_new  2019-05-07 23:18:40.584882687 +0200
@@ -12,13 +12,13 @@
 # license that conforms to the Open Source Definition (Version 1.9)
 # published by the Open Source Initiative.
 
-# Please submit bugfixes or comments via http://bugs.opensuse.org/
+# Please submit bugfixes or comments via https://bugs.opensuse.org/
 #
 
 
 %{?!python_module:%define python_module() python-%{**} python3-%{**}}
 Name:           python-pysmi
-Version:        0.3.3
+Version:        0.3.4
 Release:        0
 Summary:        SNMP SMI/MIB Parser
 License:        BSD-2-Clause

++++++ pysmi-0.3.3.tar.gz -> pysmi-0.3.4.tar.gz ++++++
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/pysmi-0.3.3/CHANGES.rst new/pysmi-0.3.4/CHANGES.rst
--- old/pysmi-0.3.3/CHANGES.rst 2018-12-29 18:21:47.000000000 +0100
+++ new/pysmi-0.3.4/CHANGES.rst 2019-04-14 12:02:48.000000000 +0200
@@ -1,4 +1,12 @@
 
+Revision 0.3.4, XX-01-2019
+--------------------------
+
+- Added `implied` key to JSON SNMP table index structure
+- Rebased MIB importing code onto `importlib` because `imp` is long
+  deprecated
+- Fixed Py file borrower to become functional
+
 Revision 0.3.3, 29-12-2018
 --------------------------
 
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/pysmi-0.3.3/PKG-INFO new/pysmi-0.3.4/PKG-INFO
--- old/pysmi-0.3.3/PKG-INFO    2018-12-29 18:22:05.000000000 +0100
+++ new/pysmi-0.3.4/PKG-INFO    2019-04-14 12:04:05.000000000 +0200
@@ -1,10 +1,11 @@
-Metadata-Version: 1.1
+Metadata-Version: 1.2
 Name: pysmi
-Version: 0.3.3
+Version: 0.3.4
 Summary: SNMP SMI/MIB Parser
 Home-page: https://github.com/etingof/pysmi
-Author: Ilya Etingof <[email protected]>
+Author: Ilya Etingof
 Author-email: [email protected]
+Maintainer: Ilya Etingof <[email protected]>
 License: BSD
 Description: A pure-Python implementation of SNMP/SMI MIB parsing and 
conversion library.
 Platform: any
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/pysmi-0.3.3/pysmi/__init__.py 
new/pysmi-0.3.4/pysmi/__init__.py
--- old/pysmi-0.3.3/pysmi/__init__.py   2018-12-29 18:21:47.000000000 +0100
+++ new/pysmi-0.3.4/pysmi/__init__.py   2019-04-14 12:02:48.000000000 +0200
@@ -1,5 +1,5 @@
 # http://www.python.org/dev/peps/pep-0396/
-__version__ = '0.3.3'
+__version__ = '0.3.4'
 
 import sys
 
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/pysmi-0.3.3/pysmi/borrower/base.py 
new/pysmi-0.3.4/pysmi/borrower/base.py
--- old/pysmi-0.3.3/pysmi/borrower/base.py      2018-12-29 18:21:47.000000000 
+0100
+++ new/pysmi-0.3.4/pysmi/borrower/base.py      2019-04-14 12:02:40.000000000 
+0200
@@ -40,8 +40,8 @@
 
         return self
 
-    def getData(self, mibname, **kwargs):
-        if bool(kwargs.get('genTexts')) != self.genTexts:
+    def getData(self, mibname, **options):
+        if bool(options.get('genTexts')) != self.genTexts:
             debug.logger & debug.flagBorrower and debug.logger(
                 'skipping incompatible borrower %s for file %s' % (self, 
mibname))
             raise error.PySmiFileNotFoundError(mibname=mibname, 
reader=self._reader)
@@ -50,4 +50,7 @@
             debug.logger('trying to borrow file %s from %s' % (mibname, 
self._reader))
         )
 
-        return self._reader.getData(mibname)
+        if 'exts' not in options:
+            options['exts'] = self.exts
+
+        return self._reader.getData(mibname, **options)
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/pysmi-0.3.3/pysmi/borrower/pyfile.py 
new/pysmi-0.3.4/pysmi/borrower/pyfile.py
--- old/pysmi-0.3.3/pysmi/borrower/pyfile.py    2018-12-29 18:21:47.000000000 
+0100
+++ new/pysmi-0.3.4/pysmi/borrower/pyfile.py    2019-04-14 12:02:40.000000000 
+0200
@@ -4,13 +4,24 @@
 # Copyright (c) 2015-2019, Ilya Etingof <[email protected]>
 # License: http://snmplabs.com/pysmi/license.html
 #
-import imp
+try:
+    import importlib
+
+    try:
+        SOURCE_SUFFIXES = importlib.machinery.SOURCE_SUFFIXES
+
+    except Exception:
+        raise ImportError()
+
+except ImportError:
+    import imp
+
+    SOURCE_SUFFIXES = [s[0] for s in imp.get_suffixes()
+                       if s[2] == imp.PY_SOURCE]
+
 from pysmi.borrower.base import AbstractBorrower
 
 
 class PyFileBorrower(AbstractBorrower):
     """Create PySNMP MIB file borrowing object"""
-    for sfx, mode, typ in imp.get_suffixes():
-        if typ == imp.PY_SOURCE:
-            exts = [sfx]
-            break
+    exts = SOURCE_SUFFIXES
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/pysmi-0.3.3/pysmi/codegen/jsondoc.py 
new/pysmi-0.3.4/pysmi/codegen/jsondoc.py
--- old/pysmi-0.3.3/pysmi/codegen/jsondoc.py    2018-12-29 18:21:47.000000000 
+0100
+++ new/pysmi-0.3.4/pysmi/codegen/jsondoc.py    2019-04-14 12:02:48.000000000 
+0200
@@ -710,6 +710,7 @@
         idxStrlist, fakeSyms, fakeStrlist = [], [], []
 
         for idx in indexes:
+            isImplied = idx[0]
             idxName = idx[1]
             if idxName in self.smiv1IdxTypes:  # SMIv1 support
                 idxType = idxName
@@ -721,6 +722,7 @@
             index = OrderedDict()
             index['module'] = self._importMap.get(idxName, self.moduleName[0])
             index['object'] = idxName
+            index['implied'] = isImplied
             idxStrlist.append(index)
 
         return idxStrlist, fakeStrlist, fakeSyms
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/pysmi-0.3.3/pysmi/reader/base.py 
new/pysmi-0.3.4/pysmi/reader/base.py
--- old/pysmi-0.3.3/pysmi/reader/base.py        2018-12-29 18:21:47.000000000 
+0100
+++ new/pysmi-0.3.4/pysmi/reader/base.py        2019-04-14 12:02:40.000000000 
+0200
@@ -22,7 +22,7 @@
             setattr(self, k, kwargs[k])
         return self
 
-    def getMibVariants(self, mibname):
+    def getMibVariants(self, mibname, **options):
         filenames = []
 
         if self.originalMatching:
@@ -45,7 +45,8 @@
                 filenames.append(suffixed.upper())
                 filenames.append(suffixed.lower())
 
-        return ((x, x + y) for x in filenames for y in self.exts)
+        return ((x, x + y) for x in filenames
+                for y in options.get('exts', self.exts))
 
-    def getData(self, filename):
+    def getData(self, filename, **options):
         raise NotImplementedError()
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/pysmi-0.3.3/pysmi/reader/callback.py 
new/pysmi-0.3.4/pysmi/reader/callback.py
--- old/pysmi-0.3.3/pysmi/reader/callback.py    2018-12-29 18:21:47.000000000 
+0100
+++ new/pysmi-0.3.4/pysmi/reader/callback.py    2019-04-14 12:02:40.000000000 
+0200
@@ -33,7 +33,7 @@
     def __str__(self):
         return '%s{"%s"}' % (self.__class__.__name__, self._cbFun)
 
-    def getData(self, mibname):
+    def getData(self, mibname, **options):
         debug.logger & debug.flagReader and debug.logger('calling user 
callback %s for MIB %s' % (self._cbFun, mibname))
 
         res = self._cbFun(mibname, self._cbCtx)
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/pysmi-0.3.3/pysmi/reader/ftpclient.py 
new/pysmi-0.3.4/pysmi/reader/ftpclient.py
--- old/pysmi-0.3.3/pysmi/reader/ftpclient.py   2018-12-29 18:21:47.000000000 
+0100
+++ new/pysmi-0.3.4/pysmi/reader/ftpclient.py   2019-04-14 12:02:40.000000000 
+0200
@@ -50,7 +50,7 @@
     def __str__(self):
         return '%s{"ftp://%s%s"}' % (self.__class__.__name__, self._host, 
self._locationTemplate)
 
-    def getData(self, mibname):
+    def getData(self, mibname, **options):
         if self._ssl:
             conn = ftplib.FTP_TLS()
         else:
@@ -74,7 +74,7 @@
 
         debug.logger & debug.flagReader and debug.logger('looking for MIB %s' 
% mibname)
 
-        for mibalias, mibfile in self.getMibVariants(mibname):
+        for mibalias, mibfile in self.getMibVariants(mibname, **options):
             location = self._locationTemplate.replace('@mib@', mibfile)
 
             mtime = time.time()
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/pysmi-0.3.3/pysmi/reader/httpclient.py 
new/pysmi-0.3.4/pysmi/reader/httpclient.py
--- old/pysmi-0.3.3/pysmi/reader/httpclient.py  2018-12-29 18:21:47.000000000 
+0100
+++ new/pysmi-0.3.4/pysmi/reader/httpclient.py  2019-04-14 12:02:40.000000000 
+0200
@@ -62,7 +62,7 @@
     def __str__(self):
         return self._url
 
-    def getData(self, mibname):
+    def getData(self, mibname, **options):
         headers = {
             'Accept': 'text/plain',
             'User-Agent': self._user_agent
@@ -72,7 +72,7 @@
 
         debug.logger & debug.flagReader and debug.logger('looking for MIB %s' 
% mibname)
 
-        for mibalias, mibfile in self.getMibVariants(mibname):
+        for mibalias, mibfile in self.getMibVariants(mibname, **options):
             if self.MIB_MAGIC in self._url:
                 url = self._url.replace(self.MIB_MAGIC, mibfile)
             else:
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/pysmi-0.3.3/pysmi/reader/localfile.py 
new/pysmi-0.3.4/pysmi/reader/localfile.py
--- old/pysmi-0.3.3/pysmi/reader/localfile.py   2018-12-29 18:21:47.000000000 
+0100
+++ new/pysmi-0.3.4/pysmi/reader/localfile.py   2019-04-14 12:02:40.000000000 
+0200
@@ -83,7 +83,7 @@
 
         return mibIndex
 
-    def getMibVariants(self, mibname):
+    def getMibVariants(self, mibname, **options):
         if self.useIndexFile:
             if not self._indexLoaded:
                 self._mibIndex = self.loadIndex(
@@ -96,15 +96,15 @@
                     'found %s in MIB index: %s' % (mibname, 
self._mibIndex[mibname]))
                 return [(mibname, self._mibIndex[mibname])]
 
-        return super(FileReader, self).getMibVariants(mibname)
+        return super(FileReader, self).getMibVariants(mibname, **options)
 
-    def getData(self, mibname):
+    def getData(self, mibname, **options):
         debug.logger & debug.flagReader and debug.logger(
             '%slooking for MIB %s' % (self._recursive and 'recursively ' or 
'', mibname))
 
         for path in self.getSubdirs(self._path, self._recursive, 
self._ignoreErrors):
 
-            for mibalias, mibfile in self.getMibVariants(mibname):
+            for mibalias, mibfile in self.getMibVariants(mibname, **options):
                 f = os.path.join(decode(path), decode(mibfile))
 
                 debug.logger & debug.flagReader and debug.logger('trying MIB 
%s' % f)
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/pysmi-0.3.3/pysmi/reader/zipreader.py 
new/pysmi-0.3.4/pysmi/reader/zipreader.py
--- old/pysmi-0.3.3/pysmi/reader/zipreader.py   2018-12-29 18:21:47.000000000 
+0100
+++ new/pysmi-0.3.4/pysmi/reader/zipreader.py   2019-04-14 12:02:40.000000000 
+0200
@@ -156,7 +156,7 @@
     def __str__(self):
         return '%s{"%s"}' % (self.__class__.__name__, self._name)
 
-    def getData(self, mibname, zipBlob=None):
+    def getData(self, mibname, **options):
         debug.logger & debug.flagReader and debug.logger('looking for MIB %s 
at %s' % (mibname, self._name))
 
         if self._pendingError:
@@ -165,7 +165,7 @@
         if not self._members:
             raise error.PySmiReaderFileNotFoundError('source MIB %s not found' 
% mibname, reader=self)
 
-        for mibalias, mibfile in self.getMibVariants(mibname):
+        for mibalias, mibfile in self.getMibVariants(mibname, **options):
 
             debug.logger & debug.flagReader and debug.logger('trying MIB %s' % 
mibfile)
 
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/pysmi-0.3.3/pysmi/searcher/pyfile.py 
new/pysmi-0.3.4/pysmi/searcher/pyfile.py
--- old/pysmi-0.3.3/pysmi/searcher/pyfile.py    2018-12-29 18:21:47.000000000 
+0100
+++ new/pysmi-0.3.4/pysmi/searcher/pyfile.py    2019-04-14 12:02:40.000000000 
+0200
@@ -7,8 +7,25 @@
 import os
 import sys
 import time
-import imp
 import struct
+try:
+    import importlib
+
+    try:
+        SOURCE_SUFFIXES = importlib.machinery.SOURCE_SUFFIXES
+        BYTECODE_SUFFIXES = importlib.machinery.BYTECODE_SUFFIXES
+
+    except Exception:
+        raise ImportError()
+
+except ImportError:
+    import imp
+
+    SOURCE_SUFFIXES = [s[0] for s in imp.get_suffixes()
+                       if s[2] == imp.PY_SOURCE]
+    BYTECODE_SUFFIXES = [s[0] for s in imp.get_suffixes()
+                         if s[2] == imp.PY_COMPILED]
+
 from pysmi.searcher.base import AbstractSearcher
 from pysmi.compat import decode
 from pysmi import debug
@@ -19,12 +36,6 @@
     """Figures out if given Python file (source or bytecode) exists at given
        location.
     """
-    suffixes = {}
-    for sfx, mode, typ in imp.get_suffixes():
-        if typ not in suffixes:
-            suffixes[typ] = []
-        suffixes[typ].append((sfx, mode))
-
     def __init__(self, path):
         """Create an instance of *PyFileSearcher* bound to specific directory.
 
@@ -44,49 +55,54 @@
         mibname = decode(mibname)
         pyfile = os.path.join(self._path, mibname)
 
-        for fmt in imp.PY_COMPILED, imp.PY_SOURCE:
-            for pySfx, pyMode in self.suffixes[fmt]:
-                f = pyfile + pySfx
-
-                if not os.path.exists(f) or not os.path.isfile(f):
-                    debug.logger & debug.flagSearcher and debug.logger('%s not 
present or not a file' % f)
-                    continue
-
-                if fmt == imp.PY_COMPILED:
-                    try:
-                        fp = open(f, pyMode)
-                        pyData = fp.read(8)
-                        fp.close()
-
-                    except IOError:
-                        raise error.PySmiSearcherError('failure opening 
compiled file %s: %s' % (f, sys.exc_info()[1]),
-                                                       searcher=self)
-                    if pyData[:4] == imp.get_magic():
-                        pyData = pyData[4:]
-                        pyTime = struct.unpack('<L', pyData[:4])[0]
-                        debug.logger & debug.flagSearcher and debug.logger(
-                            'found %s, mtime %s' % (f, time.strftime("%a, %d 
%b %Y %H:%M:%S GMT", time.gmtime(pyTime))))
-                        if pyTime >= mtime:
-                            raise error.PySmiFileNotModifiedError()
-
-                        else:
-                            raise error.PySmiFileNotFoundError('older file %s 
exists' % mibname, searcher=self)
-
-                    else:
-                        debug.logger & debug.flagSearcher and 
debug.logger('bad magic in %s' % f)
-                        continue
+        for pySfx in BYTECODE_SUFFIXES:
+            f = pyfile + pySfx
+
+            if not os.path.exists(f) or not os.path.isfile(f):
+                debug.logger & debug.flagSearcher and debug.logger('%s not 
present or not a file' % f)
+                continue
+
+            try:
+                fp = open(f, 'rb')
+                pyData = fp.read(8)
+                fp.close()
+
+            except IOError:
+                raise error.PySmiSearcherError('failure opening compiled file 
%s: %s' % (f, sys.exc_info()[1]),
+                                               searcher=self)
+            if pyData[:4] == imp.get_magic():
+                pyData = pyData[4:]
+                pyTime = struct.unpack('<L', pyData[:4])[0]
+                debug.logger & debug.flagSearcher and debug.logger(
+                    'found %s, mtime %s' % (f, time.strftime("%a, %d %b %Y 
%H:%M:%S GMT", time.gmtime(pyTime))))
+                if pyTime >= mtime:
+                    raise error.PySmiFileNotModifiedError()
+
                 else:
-                    try:
-                        pyTime = os.stat(f)[8]
+                    raise error.PySmiFileNotFoundError('older file %s exists' 
% mibname, searcher=self)
+
+            else:
+                debug.logger & debug.flagSearcher and debug.logger('bad magic 
in %s' % f)
+                continue
+
+        for pySfx in SOURCE_SUFFIXES:
+            f = pyfile + pySfx
+
+            if not os.path.exists(f) or not os.path.isfile(f):
+                debug.logger & debug.flagSearcher and debug.logger('%s not 
present or not a file' % f)
+                continue
+
+            try:
+                pyTime = os.stat(f)[8]
 
-                    except OSError:
-                        raise error.PySmiSearcherError('failure opening 
compiled file %s: %s' % (f, sys.exc_info()[1]),
-                                                       searcher=self)
+            except OSError:
+                raise error.PySmiSearcherError('failure opening compiled file 
%s: %s' % (f, sys.exc_info()[1]),
+                                               searcher=self)
 
-                    debug.logger & debug.flagSearcher and debug.logger(
-                        'found %s, mtime %s' % (f, time.strftime("%a, %d %b %Y 
%H:%M:%S GMT", time.gmtime(pyTime))))
+            debug.logger & debug.flagSearcher and debug.logger(
+                'found %s, mtime %s' % (f, time.strftime("%a, %d %b %Y 
%H:%M:%S GMT", time.gmtime(pyTime))))
 
-                    if pyTime >= mtime:
-                        raise error.PySmiFileNotModifiedError()
+            if pyTime >= mtime:
+                raise error.PySmiFileNotModifiedError()
 
         raise error.PySmiFileNotFoundError('no compiled file %s found' % 
mibname, searcher=self)
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/pysmi-0.3.3/pysmi/searcher/pypackage.py 
new/pysmi-0.3.4/pysmi/searcher/pypackage.py
--- old/pysmi-0.3.3/pysmi/searcher/pypackage.py 2018-12-29 18:21:47.000000000 
+0100
+++ new/pysmi-0.3.4/pysmi/searcher/pypackage.py 2019-04-14 12:02:40.000000000 
+0200
@@ -6,8 +6,27 @@
 #
 import os
 import time
-import imp
 import struct
+try:
+    import importlib
+
+    try:
+        PY_MAGIC_NUMBER = importlib.util.MAGIC_NUMBER
+        SOURCE_SUFFIXES = importlib.machinery.SOURCE_SUFFIXES
+        BYTECODE_SUFFIXES = importlib.machinery.BYTECODE_SUFFIXES
+
+    except Exception:
+        raise ImportError()
+
+except ImportError:
+    import imp
+
+    PY_MAGIC_NUMBER = imp.get_magic()
+    SOURCE_SUFFIXES = [s[0] for s in imp.get_suffixes()
+                       if s[2] == imp.PY_SOURCE]
+    BYTECODE_SUFFIXES = [s[0] for s in imp.get_suffixes()
+                         if s[2] == imp.PY_COMPILED]
+
 from pysmi.searcher.base import AbstractSearcher
 from pysmi.searcher.pyfile import PyFileSearcher
 from pysmi.compat import decode
@@ -21,13 +40,6 @@
 
        Python package must be importable.
     """
-    suffixes = {}
-    for sfx, mode, typ in imp.get_suffixes():
-        if typ not in suffixes:
-            suffixes[typ] = []
-
-        suffixes[typ].append((sfx, mode))
-
     def __init__(self, package):
         """Create an instance of *PyPackageSearcher* bound to specific Python
            package.
@@ -82,41 +94,46 @@
         except ImportError:
             raise error.PySmiFileNotFoundError('%s is not importable, trying 
as a path' % self._package, searcher=self)
 
-        for fmt in imp.PY_COMPILED, imp.PY_SOURCE:
-            for pySfx, pyMode in self.suffixes[fmt]:
-                f = os.path.join(self._package, mibname.upper()) + pySfx
-
-                if f not in self.__loader._files:
-                    debug.logger & debug.flagSearcher and debug.logger('%s is 
not in %s' % (f, self._package))
-                    continue
-
-                if fmt == imp.PY_COMPILED:
-                    pyData = self.__loader.get_data(f)
-                    if pyData[:4] == imp.get_magic():
-                        pyData = pyData[4:]
-                        pyTime = struct.unpack('<L', pyData[:4])[0]
-                        debug.logger & debug.flagSearcher and debug.logger(
-                            'found %s, mtime %s' % (f, time.strftime("%a, %d 
%b %Y %H:%M:%S GMT", time.gmtime(pyTime))))
-                        if pyTime >= mtime:
-                            raise error.PySmiFileNotModifiedError()
-                        else:
-                            raise error.PySmiFileNotFoundError('older file %s 
exists' % mibname, searcher=self)
-
-                    else:
-                        debug.logger & debug.flagSearcher and 
debug.logger('bad magic in %s' % f)
-                        continue
+        for pySfx in BYTECODE_SUFFIXES:
+            f = os.path.join(self._package, mibname.upper()) + pySfx
 
+            if f not in self.__loader._files:
+                debug.logger & debug.flagSearcher and debug.logger('%s is not 
in %s' % (f, self._package))
+                continue
+
+            pyData = self.__loader.get_data(f)
+            if pyData[:4] == PY_MAGIC_NUMBER:
+                pyData = pyData[4:]
+                pyTime = struct.unpack('<L', pyData[:4])[0]
+                debug.logger & debug.flagSearcher and debug.logger(
+                    'found %s, mtime %s' % (f, time.strftime("%a, %d %b %Y 
%H:%M:%S GMT", time.gmtime(pyTime))))
+                if pyTime >= mtime:
+                    raise error.PySmiFileNotModifiedError()
                 else:
-                    pyTime = self._parseDosTime(
-                        self.__loader._files[f][6],
-                        self.__loader._files[f][5]
-                    )
-
-                    debug.logger & debug.flagSearcher and debug.logger(
-                        'found %s, mtime %s' % (f, time.strftime("%a, %d %b %Y 
%H:%M:%S GMT", time.gmtime(pyTime))))
-                    if pyTime >= mtime:
-                        raise error.PySmiFileNotModifiedError()
-                    else:
-                        raise error.PySmiFileNotFoundError('older file %s 
exists' % mibname, searcher=self)
+                    raise error.PySmiFileNotFoundError('older file %s exists' 
% mibname, searcher=self)
+
+            else:
+                debug.logger & debug.flagSearcher and debug.logger('bad magic 
in %s' % f)
+                continue
+
+        for pySfx in SOURCE_SUFFIXES:
+
+            f = os.path.join(self._package, mibname.upper()) + pySfx
+
+            if f not in self.__loader._files:
+                debug.logger & debug.flagSearcher and debug.logger('%s is not 
in %s' % (f, self._package))
+                continue
+
+            pyTime = self._parseDosTime(
+                self.__loader._files[f][6],
+                self.__loader._files[f][5]
+            )
+
+            debug.logger & debug.flagSearcher and debug.logger(
+                'found %s, mtime %s' % (f, time.strftime("%a, %d %b %Y 
%H:%M:%S GMT", time.gmtime(pyTime))))
+            if pyTime >= mtime:
+                raise error.PySmiFileNotModifiedError()
+            else:
+                raise error.PySmiFileNotFoundError('older file %s exists' % 
mibname, searcher=self)
 
         raise error.PySmiFileNotFoundError('no file %s found' % mibname, 
searcher=self)
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/pysmi-0.3.3/pysmi/writer/pyfile.py 
new/pysmi-0.3.4/pysmi/writer/pyfile.py
--- old/pysmi-0.3.3/pysmi/writer/pyfile.py      2018-12-29 18:21:47.000000000 
+0100
+++ new/pysmi-0.3.4/pysmi/writer/pyfile.py      2019-04-14 12:02:40.000000000 
+0200
@@ -6,9 +6,24 @@
 #
 import os
 import sys
-import imp
 import tempfile
 import py_compile
+
+try:
+    import importlib
+
+    try:
+        SOURCE_SUFFIXES = importlib.machinery.SOURCE_SUFFIXES
+
+    except Exception:
+        raise ImportError()
+
+except ImportError:
+    import imp
+
+    SOURCE_SUFFIXES = [s[0] for s in imp.get_suffixes()
+                       if s[2] == imp.PY_SOURCE]
+
 from pysmi.writer.base import AbstractWriter
 from pysmi.compat import encode, decode
 from pysmi import debug
@@ -24,14 +39,6 @@
     pyCompile = True
     pyOptimizationLevel = -1
 
-    suffixes = {}
-
-    for sfx, mode, typ in imp.get_suffixes():
-        if typ not in suffixes:
-            suffixes[typ] = []
-
-        suffixes[typ].append((decode(sfx), mode))
-
     def __init__(self, path):
         """Creates an instance of *PyFileWriter* class.
 
@@ -59,7 +66,8 @@
         if comments:
             data = '#\n' + ''.join(['# %s\n' % x for x in comments]) + '#\n' + 
data
 
-        pyfile = os.path.join(self._path, decode(mibname)) + 
self.suffixes[imp.PY_SOURCE][0][0]
+        pyfile = os.path.join(self._path, decode(mibname))
+        pyfile += SOURCE_SUFFIXES[0]
 
         tfile = None
 
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/pysmi-0.3.3/pysmi.egg-info/PKG-INFO 
new/pysmi-0.3.4/pysmi.egg-info/PKG-INFO
--- old/pysmi-0.3.3/pysmi.egg-info/PKG-INFO     2018-12-29 18:22:05.000000000 
+0100
+++ new/pysmi-0.3.4/pysmi.egg-info/PKG-INFO     2019-04-14 12:04:05.000000000 
+0200
@@ -1,10 +1,11 @@
-Metadata-Version: 1.1
+Metadata-Version: 1.2
 Name: pysmi
-Version: 0.3.3
+Version: 0.3.4
 Summary: SNMP SMI/MIB Parser
 Home-page: https://github.com/etingof/pysmi
-Author: Ilya Etingof <[email protected]>
+Author: Ilya Etingof
 Author-email: [email protected]
+Maintainer: Ilya Etingof <[email protected]>
 License: BSD
 Description: A pure-Python implementation of SNMP/SMI MIB parsing and 
conversion library.
 Platform: any
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/pysmi-0.3.3/setup.cfg new/pysmi-0.3.4/setup.cfg
--- old/pysmi-0.3.3/setup.cfg   2018-12-29 18:22:05.000000000 +0100
+++ new/pysmi-0.3.4/setup.cfg   2019-04-14 12:04:05.000000000 +0200
@@ -7,5 +7,4 @@
 [egg_info]
 tag_build = 
 tag_date = 0
-tag_svn_revision = 0
 


Reply via email to