Show More
@@ -47,10 +47,10 b' for i, m in enumerate(old):' | |||||
47 | m2.type = m.type |
|
47 | m2.type = m.type | |
48 | m2.linkname = m.linkname |
|
48 | m2.linkname = m.linkname | |
49 | if m.isdir(): |
|
49 | if m.isdir(): | |
|
50 | new.addfile(m2) | |||
|
51 | else: | |||
50 | data = old.extractfile(m) |
|
52 | data = old.extractfile(m) | |
51 | new.addfile(m2, data) |
|
53 | new.addfile(m2, data) | |
52 | else: |
|
|||
53 | new.addfile(m2) |
|
|||
54 | new.close() |
|
54 | new.close() | |
55 | old.close() |
|
55 | old.close() | |
56 |
|
56 | |||
@@ -58,3 +58,7 b' buf.seek(0)' | |||||
58 | with open(sys.argv[1], "wb") as f: |
|
58 | with open(sys.argv[1], "wb") as f: | |
59 | with gzip.GzipFile('', "wb", fileobj=f, mtime=timestamp) as gzf: |
|
59 | with gzip.GzipFile('', "wb", fileobj=f, mtime=timestamp) as gzf: | |
60 | gzf.write(buf.read()) |
|
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