mirror of
https://github.com/kovidgoyal/calibre.git
synced 2025-07-07 10:14:46 -04:00
Fix plugins not working in calibre portable
This commit is contained in:
parent
c36e2ace17
commit
bb70c07c33
@ -355,11 +355,17 @@ def remove_plugin(plugin_or_name):
|
|||||||
name = getattr(plugin_or_name, 'name', plugin_or_name)
|
name = getattr(plugin_or_name, 'name', plugin_or_name)
|
||||||
plugins = config['plugins']
|
plugins = config['plugins']
|
||||||
removed = False
|
removed = False
|
||||||
if name in plugins.keys():
|
if name in plugins:
|
||||||
removed = True
|
removed = True
|
||||||
zfp = plugins[name]
|
try:
|
||||||
if os.path.exists(zfp):
|
zfp = os.path.join(plugin_dir, name+'.zip')
|
||||||
os.remove(zfp)
|
if os.path.exists(zfp):
|
||||||
|
os.remove(zfp)
|
||||||
|
zfp = plugins[name]
|
||||||
|
if os.path.exists(zfp):
|
||||||
|
os.remove(zfp)
|
||||||
|
except:
|
||||||
|
pass
|
||||||
plugins.pop(name)
|
plugins.pop(name)
|
||||||
config['plugins'] = plugins
|
config['plugins'] = plugins
|
||||||
initialize_plugins()
|
initialize_plugins()
|
||||||
@ -495,8 +501,15 @@ def initialize_plugins():
|
|||||||
builtin_names]
|
builtin_names]
|
||||||
for p in conflicts:
|
for p in conflicts:
|
||||||
remove_plugin(p)
|
remove_plugin(p)
|
||||||
for zfp in list(config['plugins'].itervalues()) + builtin_plugins:
|
external_plugins = config['plugins']
|
||||||
|
for zfp in list(external_plugins) + builtin_plugins:
|
||||||
try:
|
try:
|
||||||
|
if not isinstance(zfp, type):
|
||||||
|
# We have a plugin name
|
||||||
|
pname = zfp
|
||||||
|
zfp = os.path.join(plugin_dir, zfp+'.zip')
|
||||||
|
if not os.path.exists(zfp):
|
||||||
|
zfp = external_plugins[pname]
|
||||||
try:
|
try:
|
||||||
plugin = load_plugin(zfp) if not isinstance(zfp, type) else zfp
|
plugin = load_plugin(zfp) if not isinstance(zfp, type) else zfp
|
||||||
except PluginNotFound:
|
except PluginNotFound:
|
||||||
|
Loading…
x
Reference in New Issue
Block a user