Show More
@@ -47,10 +47,10 b' for i, m in enumerate(old):' | |||
|
47 | 47 | m2.type = m.type |
|
48 | 48 | m2.linkname = m.linkname |
|
49 | 49 | if m.isdir(): |
|
50 | new.addfile(m2) | |
|
51 | else: | |
|
50 | 52 | data = old.extractfile(m) |
|
51 | 53 | new.addfile(m2, data) |
|
52 | else: | |
|
53 | new.addfile(m2) | |
|
54 | 54 | new.close() |
|
55 | 55 | old.close() |
|
56 | 56 | |
@@ -58,3 +58,7 b' buf.seek(0)' | |||
|
58 | 58 | with open(sys.argv[1], "wb") as f: |
|
59 | 59 | with gzip.GzipFile('', "wb", fileobj=f, mtime=timestamp) as gzf: |
|
60 | 60 | gzf.write(buf.read()) |
|
61 | ||
|
62 | # checks the archive is valid. | |
|
63 | archive = tarfile.open(sys.argv[1]) | |
|
64 | names = archive.getnames() |
General Comments 0
You need to be logged in to leave comments.
Login now