fix archive module can not compress a single file in a tar file (#45117)

fixes #44968
This commit is contained in:
Giovanni Sciortino 2018-11-30 11:49:35 +01:00 committed by John R Barker
commit 95718f7e12

View file

@ -426,7 +426,10 @@ def main():
arcfile.write(path, path[len(arcroot):])
arcfile.close()
state = 'archive' # because all zip files are archives
elif format == 'tar':
arcfile = tarfile.open(dest, 'w')
arcfile.add(path)
arcfile.close()
else:
f_in = open(path, 'rb')