diff options
Diffstat (limited to 'importpkg.py')
-rwxr-xr-x | importpkg.py | 13 |
1 files changed, 3 insertions, 10 deletions
diff --git a/importpkg.py b/importpkg.py index 01ec87a..dac4bb1 100755 --- a/importpkg.py +++ b/importpkg.py @@ -11,13 +11,12 @@ import sys import tarfile import zlib -import lzma import yaml from dedup.debpkg import DebExtractor, process_control, get_tar_hashes from dedup.hashing import DecompressedHash, SuppressingHash, HashedStream, \ HashBlacklistContent -from dedup.compression import GzipDecompressor, DecompressedStream +from dedup.compression import GzipDecompressor, decompress from dedup.image import GIFHash, PNGHash boring_content = set(("", "\n")) @@ -44,14 +43,8 @@ def gifhash(): return hashobj def decompress_tar(filelike, extension): - if extension in (b".lzma", b".xz"): - filelike = DecompressedStream(filelike, lzma.LZMADecompressor()) - extension = b"" - if extension not in (b"", b".gz", b".bz2"): - raise ValueError("unknown compression format with extension %r" % - extension) - return tarfile.open(fileobj=filelike, - mode="r|" + extension[1:].decode("ascii")) + filelike = decompress(filelike, extension.decode("ascii")) + return tarfile.open(fileobj=filelike, mode="r|") class ProcessingFinished(Exception): pass |