mirror of
https://github.com/saltstack/salt.git
synced 2025-04-17 10:10:20 +00:00
Correctly pop the path we added after loader is completed.
Before this was doing a .pop() which would remove the last thing in sys.path, which is not necessarily the thing we added (in the case that an import modifies sys.path). The original fix was introduced in 4bf1d6838a
, this simply ensures that we remove the item we added.
This commit is contained in:
parent
8704750cf9
commit
dd5051c9e6
1 changed files with 3 additions and 2 deletions
|
@ -1095,8 +1095,9 @@ class LazyLoader(salt.utils.lazy.LazyDict):
|
|||
mod = None
|
||||
fpath, suffix = self.file_mapping[name]
|
||||
self.loaded_files.add(name)
|
||||
fpath_dirname = os.path.dirname(fpath)
|
||||
try:
|
||||
sys.path.append(os.path.dirname(fpath))
|
||||
sys.path.append(fpath_dirname)
|
||||
if suffix == '.pyx':
|
||||
mod = pyximport.load_module(name, fpath, tempfile.gettempdir())
|
||||
elif suffix == '.o':
|
||||
|
@ -1162,7 +1163,7 @@ class LazyLoader(salt.utils.lazy.LazyDict):
|
|||
)
|
||||
return False
|
||||
finally:
|
||||
sys.path.pop()
|
||||
sys.path.remove(fpath_dirname)
|
||||
|
||||
if hasattr(mod, '__opts__'):
|
||||
mod.__opts__.update(self.opts)
|
||||
|
|
Loading…
Add table
Reference in a new issue