mirror of
https://github.com/valitydev/salt.git
synced 2024-11-08 01:18:58 +00:00
Don't use the deprecated imp.get_suffixes()
under Py3.
This commit is contained in:
parent
2d5e06554a
commit
96021565a9
@ -44,6 +44,20 @@ log = logging.getLogger(__name__)
|
||||
SALT_BASE_PATH = os.path.abspath(os.path.dirname(salt.__file__))
|
||||
LOADED_BASE_NAME = 'salt.loaded'
|
||||
|
||||
if six.PY3:
|
||||
# pylint: disable=no-member,no-name-in-module,import-error
|
||||
import importlib.machinery
|
||||
SUFFIXES = []
|
||||
for suffix in importlib.machinery.EXTENSION_SUFFIXES:
|
||||
SUFFIXES.append((suffix, 'rb', 3))
|
||||
for suffix in importlib.machinery.BYTECODE_SUFFIXES:
|
||||
SUFFIXES.append((suffix, 'rb', 2))
|
||||
for suffix in importlib.machinery.SOURCE_SUFFIXES:
|
||||
SUFFIXES.append((suffix, 'r', 1))
|
||||
# pylint: enable=no-member,no-name-in-module,import-error
|
||||
else:
|
||||
SUFFIXES = imp.get_suffixes()
|
||||
|
||||
# Because on the cloud drivers we do `from salt.cloud.libcloudfuncs import *`
|
||||
# which simplifies code readability, it adds some unsupported functions into
|
||||
# the driver's module scope.
|
||||
@ -969,7 +983,7 @@ class LazyLoader(salt.utils.lazy.LazyDict):
|
||||
# map of suffix to description for imp
|
||||
self.suffix_map = {}
|
||||
suffix_order = [] # local list to determine precedence of extensions
|
||||
for (suffix, mode, kind) in imp.get_suffixes():
|
||||
for (suffix, mode, kind) in SUFFIXES:
|
||||
self.suffix_map[suffix] = (suffix, mode, kind)
|
||||
suffix_order.append(suffix)
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user