mirror of
https://github.com/kovidgoyal/calibre.git
synced 2025-07-09 03:04:10 -04:00
Add plugins to end of sys.path instead of start
This gives same semantics for frozen and non-frozen builds.
This commit is contained in:
parent
3dd9598139
commit
745bbccd93
@ -300,14 +300,14 @@ class Plugin(object): # {{{
|
|||||||
if not zip_safe:
|
if not zip_safe:
|
||||||
break
|
break
|
||||||
if zip_safe:
|
if zip_safe:
|
||||||
sys.path.insert(0, self.plugin_path)
|
sys.path.append(self.plugin_path)
|
||||||
self.sys_insertion_path = self.plugin_path
|
self.sys_insertion_path = self.plugin_path
|
||||||
else:
|
else:
|
||||||
from calibre.ptempfile import TemporaryDirectory
|
from calibre.ptempfile import TemporaryDirectory
|
||||||
self._sys_insertion_tdir = TemporaryDirectory('plugin_unzip')
|
self._sys_insertion_tdir = TemporaryDirectory('plugin_unzip')
|
||||||
self.sys_insertion_path = self._sys_insertion_tdir.__enter__(*args)
|
self.sys_insertion_path = self._sys_insertion_tdir.__enter__(*args)
|
||||||
zf.extractall(self.sys_insertion_path)
|
zf.extractall(self.sys_insertion_path)
|
||||||
sys.path.insert(0, self.sys_insertion_path)
|
sys.path.append(self.sys_insertion_path)
|
||||||
|
|
||||||
def __exit__(self, *args):
|
def __exit__(self, *args):
|
||||||
ip, it = getattr(self, 'sys_insertion_path', None), getattr(self,
|
ip, it = getattr(self, 'sys_insertion_path', None), getattr(self,
|
||||||
|
Loading…
x
Reference in New Issue
Block a user