|
11 | 11 | import collections |
12 | 12 | import errno |
13 | 13 |
|
14 | | -try: |
15 | | - import zlib |
16 | | - del zlib |
17 | | - _ZLIB_SUPPORTED = True |
18 | | -except ImportError: |
19 | | - _ZLIB_SUPPORTED = False |
20 | 14 |
|
21 | 15 | try: |
22 | 16 | import bz2 |
@@ -1000,7 +994,7 @@ def _make_tarball(base_name, base_dir, compress="gzip", verbose=0, dry_run=0, |
1000 | 994 | """ |
1001 | 995 | if compress is None: |
1002 | 996 | tar_compression = '' |
1003 | | - elif _ZLIB_SUPPORTED and compress == 'gzip': |
| 997 | + elif compress == 'gzip': |
1004 | 998 | tar_compression = 'gz' |
1005 | 999 | elif _BZ2_SUPPORTED and compress == 'bzip2': |
1006 | 1000 | tar_compression = 'bz2' |
@@ -1121,10 +1115,9 @@ def _make_zipfile(base_name, base_dir, verbose=0, dry_run=0, |
1121 | 1115 | "uncompressed tar file"), |
1122 | 1116 | } |
1123 | 1117 |
|
1124 | | -if _ZLIB_SUPPORTED: |
1125 | | - _ARCHIVE_FORMATS['gztar'] = (_make_tarball, [('compress', 'gzip')], |
1126 | | - "gzip'ed tar-file") |
1127 | | - _ARCHIVE_FORMATS['zip'] = (_make_zipfile, [], "ZIP file") |
| 1118 | +_ARCHIVE_FORMATS['gztar'] = (_make_tarball, [('compress', 'gzip')], |
| 1119 | + "gzip'ed tar-file") |
| 1120 | +_ARCHIVE_FORMATS['zip'] = (_make_zipfile, [], "ZIP file") |
1128 | 1121 |
|
1129 | 1122 | if _BZ2_SUPPORTED: |
1130 | 1123 | _ARCHIVE_FORMATS['bztar'] = (_make_tarball, [('compress', 'bzip2')], |
@@ -1345,12 +1338,9 @@ def _unpack_tarfile(filename, extract_dir, *, filter=None): |
1345 | 1338 | _UNPACK_FORMATS = { |
1346 | 1339 | 'tar': (['.tar'], _unpack_tarfile, [], "uncompressed tar file"), |
1347 | 1340 | 'zip': (['.zip'], _unpack_zipfile, [], "ZIP file"), |
| 1341 | + 'gztar': (['.tar.gz', '.tgz'], _unpack_tarfile, [], "gzip'ed tar-file"), |
1348 | 1342 | } |
1349 | 1343 |
|
1350 | | -if _ZLIB_SUPPORTED: |
1351 | | - _UNPACK_FORMATS['gztar'] = (['.tar.gz', '.tgz'], _unpack_tarfile, [], |
1352 | | - "gzip'ed tar-file") |
1353 | | - |
1354 | 1344 | if _BZ2_SUPPORTED: |
1355 | 1345 | _UNPACK_FORMATS['bztar'] = (['.tar.bz2', '.tbz2'], _unpack_tarfile, [], |
1356 | 1346 | "bzip2'ed tar-file") |
|
0 commit comments