mirror of
https://github.com/kovidgoyal/calibre.git
synced 2025-07-08 02:34:06 -04:00
No need to manipulate sys.path when importing calibre extensions in frozen builds
This commit is contained in:
parent
29bfafa676
commit
ccdfbe96d5
@ -214,6 +214,7 @@ class Plugins(collections.Mapping):
|
|||||||
def load_plugin(self, name):
|
def load_plugin(self, name):
|
||||||
if name in self._plugins:
|
if name in self._plugins:
|
||||||
return
|
return
|
||||||
|
if not isfrozen:
|
||||||
sys.path.insert(0, plugins_loc)
|
sys.path.insert(0, plugins_loc)
|
||||||
try:
|
try:
|
||||||
del sys.modules[name]
|
del sys.modules[name]
|
||||||
@ -229,6 +230,7 @@ class Plugins(collections.Mapping):
|
|||||||
except Exception:
|
except Exception:
|
||||||
plugin_err = as_unicode(native_string_type(err), encoding=preferred_encoding, errors='replace')
|
plugin_err = as_unicode(native_string_type(err), encoding=preferred_encoding, errors='replace')
|
||||||
self._plugins[name] = p, plugin_err
|
self._plugins[name] = p, plugin_err
|
||||||
|
if not isfrozen:
|
||||||
sys.path.remove(plugins_loc)
|
sys.path.remove(plugins_loc)
|
||||||
|
|
||||||
def __iter__(self):
|
def __iter__(self):
|
||||||
|
Loading…
x
Reference in New Issue
Block a user