mirror of
https://github.com/crawlab-team/crawlab.git
synced 2026-01-22 17:31:03 +01:00
updated Dockerfile
This commit is contained in:
@@ -2,7 +2,7 @@ import os, zipfile
|
||||
|
||||
|
||||
# 打包目录为zip文件(未压缩)
|
||||
def make_zip(source_dir, output_filename):
|
||||
def zip_file(source_dir, output_filename):
|
||||
zipf = zipfile.ZipFile(output_filename, 'w')
|
||||
pre_len = len(os.path.dirname(source_dir))
|
||||
for parent, dirnames, filenames in os.walk(source_dir):
|
||||
@@ -11,3 +11,13 @@ def make_zip(source_dir, output_filename):
|
||||
arcname = pathfile[pre_len:].strip(os.path.sep) # 相对路径
|
||||
zipf.write(pathfile, arcname)
|
||||
zipf.close()
|
||||
|
||||
|
||||
def unzip_file(zip_src, dst_dir):
|
||||
r = zipfile.is_zipfile(zip_src)
|
||||
if r:
|
||||
fz = zipfile.ZipFile(zip_src, 'r')
|
||||
for file in fz.namelist():
|
||||
fz.extract(file, dst_dir)
|
||||
else:
|
||||
print('This is not zip')
|
||||
|
||||
Reference in New Issue
Block a user