From e6bc38edc9d0b9c8a34971ae8bcf0f0d53607f5e Mon Sep 17 00:00:00 2001 From: Helmut Grohne Date: Sun, 1 May 2016 14:31:56 +0200 Subject: push more functionality into DebExtractor The handle_ar_member and handle_ar_end methods now have a default implementation adding further handlers handle_debversion, handle_control_tar and handle_data_tar. In that process two additional bugs were fixed: * decompress_tar was wrongly passing errors="surrogateescape" for Python 2.x even though that's only supported for Python 3.x. * The use of decompress actually passes the extension as unicode. --- dedup/compression.py | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) (limited to 'dedup/compression.py') diff --git a/dedup/compression.py b/dedup/compression.py index 5df6613..7f6dc99 100644 --- a/dedup/compression.py +++ b/dedup/compression.py @@ -156,10 +156,10 @@ class DecompressedStream(object): self.closed = True decompressors = { - '.gz': GzipDecompressor, - '.bz2': bz2.BZ2Decompressor, - '.lzma': lzma.LZMADecompressor, - '.xz': lzma.LZMADecompressor, + u'.gz': GzipDecompressor, + u'.bz2': bz2.BZ2Decompressor, + u'.lzma': lzma.LZMADecompressor, + u'.xz': lzma.LZMADecompressor, } def decompress(filelike, extension): @@ -168,7 +168,7 @@ def decompress(filelike, extension): close(). @param extension: permitted values are "", ".gz", ".bz2", ".lzma", and ".xz" - @type extension: str + @type extension: unicode @returns: a read-only byte-stream with the decompressed contents of the original filelike. It supports read(size) and close(). If the original supports seek(pos) and tell(), then it also supports -- cgit v1.2.3