updated Dockerfile

This commit is contained in:
Marvin Zhang
2019-02-28 18:57:44 +08:00
parent cf1d1ca878
commit ae5ea03043
19 changed files with 236 additions and 59 deletions

View File

@@ -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')