Add merge zips
This commit is contained in:
parent
9eb5147eab
commit
689aee0a1d
|
@ -596,21 +596,6 @@ class LODialog(object):
|
||||||
return
|
return
|
||||||
|
|
||||||
|
|
||||||
# ~ Export ok
|
|
||||||
def merge_zip(target, zips):
|
|
||||||
try:
|
|
||||||
with zipfile.ZipFile(target, 'w', compression=zipfile.ZIP_DEFLATED) as t:
|
|
||||||
for path in zips:
|
|
||||||
with zipfile.ZipFile(path, compression=zipfile.ZIP_DEFLATED) as s:
|
|
||||||
for name in s.namelist():
|
|
||||||
t.writestr(name, s.open(name).read())
|
|
||||||
except Exception as e:
|
|
||||||
error(e)
|
|
||||||
return False
|
|
||||||
|
|
||||||
return True
|
|
||||||
|
|
||||||
|
|
||||||
# ~ Export ok
|
# ~ Export ok
|
||||||
def format(template, data):
|
def format(template, data):
|
||||||
"""
|
"""
|
||||||
|
|
|
@ -6181,6 +6181,20 @@ class Paths(object):
|
||||||
z.extractall(path, members=members, pwd=pwd)
|
z.extractall(path, members=members, pwd=pwd)
|
||||||
return True
|
return True
|
||||||
|
|
||||||
|
@classmethod
|
||||||
|
def merge_zip(cls, target, zips):
|
||||||
|
try:
|
||||||
|
with zipfile.ZipFile(target, 'w', compression=zipfile.ZIP_DEFLATED) as t:
|
||||||
|
for path in zips:
|
||||||
|
with zipfile.ZipFile(path, compression=zipfile.ZIP_DEFLATED) as s:
|
||||||
|
for name in s.namelist():
|
||||||
|
t.writestr(name, s.open(name).read())
|
||||||
|
except Exception as e:
|
||||||
|
error(e)
|
||||||
|
return False
|
||||||
|
|
||||||
|
return True
|
||||||
|
|
||||||
@classmethod
|
@classmethod
|
||||||
def copy(cls, source, target='', name=''):
|
def copy(cls, source, target='', name=''):
|
||||||
p, f, n, e = _P(source).info
|
p, f, n, e = _P(source).info
|
||||||
|
|
Loading…
Reference in New Issue