mirror of
https://github.com/kovidgoyal/calibre.git
synced 2025-07-09 03:04:10 -04:00
Fix #3861 (calibre locks zip file when plugin not found)
This commit is contained in:
parent
712e082dc4
commit
90414033ca
@ -3,6 +3,7 @@ __license__ = 'GPL v3'
|
|||||||
__copyright__ = '2008, Kovid Goyal <kovid at kovidgoyal.net>'
|
__copyright__ = '2008, Kovid Goyal <kovid at kovidgoyal.net>'
|
||||||
|
|
||||||
import os, shutil, traceback, functools, sys, re
|
import os, shutil, traceback, functools, sys, re
|
||||||
|
from contextlib import closing
|
||||||
|
|
||||||
from calibre.customize import Plugin, FileTypePlugin, MetadataReaderPlugin, \
|
from calibre.customize import Plugin, FileTypePlugin, MetadataReaderPlugin, \
|
||||||
MetadataWriterPlugin
|
MetadataWriterPlugin
|
||||||
@ -51,7 +52,7 @@ def load_plugin(path_to_zip_file):
|
|||||||
#print 'Loading plugin from', path_to_zip_file
|
#print 'Loading plugin from', path_to_zip_file
|
||||||
if not os.access(path_to_zip_file, os.R_OK):
|
if not os.access(path_to_zip_file, os.R_OK):
|
||||||
raise PluginNotFound
|
raise PluginNotFound
|
||||||
zf = ZipFile(path_to_zip_file)
|
with closing(ZipFile(path_to_zip_file)) as zf:
|
||||||
for name in zf.namelist():
|
for name in zf.namelist():
|
||||||
if name.lower().endswith('plugin.py'):
|
if name.lower().endswith('plugin.py'):
|
||||||
locals = {}
|
locals = {}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user