mirror of
https://github.com/janeczku/calibre-web
synced 2024-11-28 12:30:00 +00:00
Bugfix Updater python3
Bugfix Updater in case of error
This commit is contained in:
parent
ee4ec8b122
commit
c27805b4e7
@ -13,6 +13,7 @@ import os
|
|||||||
import traceback
|
import traceback
|
||||||
import re
|
import re
|
||||||
import unicodedata
|
import unicodedata
|
||||||
|
from io import BytesIO
|
||||||
|
|
||||||
try:
|
try:
|
||||||
from StringIO import StringIO
|
from StringIO import StringIO
|
||||||
@ -386,7 +387,7 @@ class Updater(threading.Thread):
|
|||||||
r = requests.get('https://api.github.com/repos/janeczku/calibre-web/zipball/master', stream=True)
|
r = requests.get('https://api.github.com/repos/janeczku/calibre-web/zipball/master', stream=True)
|
||||||
fname = re.findall("filename=(.+)", r.headers['content-disposition'])[0]
|
fname = re.findall("filename=(.+)", r.headers['content-disposition'])[0]
|
||||||
self.status = 2
|
self.status = 2
|
||||||
z = zipfile.ZipFile(StringIO(r.content))
|
z = zipfile.ZipFile(BytesIO(r.content))
|
||||||
self.status = 3
|
self.status = 3
|
||||||
tmp_dir = gettempdir()
|
tmp_dir = gettempdir()
|
||||||
z.extractall(tmp_dir)
|
z.extractall(tmp_dir)
|
||||||
@ -481,7 +482,7 @@ class Updater(threading.Thread):
|
|||||||
if change_permissions:
|
if change_permissions:
|
||||||
try:
|
try:
|
||||||
os.chown(dst_file, permission.st_uid, permission.st_gid)
|
os.chown(dst_file, permission.st_uid, permission.st_gid)
|
||||||
except Exception:
|
except (Exception) as e:
|
||||||
# ex = sys.exc_info()
|
# ex = sys.exc_info()
|
||||||
old_permissions = os.stat(dst_file)
|
old_permissions = os.stat(dst_file)
|
||||||
logging.getLogger('cps.web').debug('Fail change permissions of ' + str(dst_file) + '. Before: '
|
logging.getLogger('cps.web').debug('Fail change permissions of ' + str(dst_file) + '. Before: '
|
||||||
|
Loading…
Reference in New Issue
Block a user