58 RECURSE_ONCE = 2 |
58 RECURSE_ONCE = 2 |
59 RECURSE_NOT_NOW = 3 |
59 RECURSE_NOT_NOW = 3 |
60 RECURSE_NEVER = 4 |
60 RECURSE_NEVER = 4 |
61 |
61 |
62 mimetypes.encodings_map.setdefault('.bz2', 'bzip2') |
62 mimetypes.encodings_map.setdefault('.bz2', 'bzip2') |
|
63 mimetypes.encodings_map.setdefault('.lzma', 'lzma') |
63 mimetypes.types_map.setdefault('.gem', 'x-ruby-gem') |
64 mimetypes.types_map.setdefault('.gem', 'x-ruby-gem') |
64 |
65 |
65 logger = logging.getLogger('dtrx-log') |
66 logger = logging.getLogger('dtrx-log') |
66 |
67 |
67 def run_command(command, description, stdout=None, stderr=None, stdin=None): |
68 def run_command(command, description, stdout=None, stderr=None, stdin=None): |
108 class ExtractorError(Exception): |
109 class ExtractorError(Exception): |
109 pass |
110 pass |
110 |
111 |
111 |
112 |
112 class BaseExtractor(object): |
113 class BaseExtractor(object): |
113 decoders = {'bzip2': 'bzcat', 'gzip': 'zcat', 'compress': 'zcat'} |
114 decoders = {'bzip2': 'bzcat', 'gzip': 'zcat', 'compress': 'zcat', |
|
115 'lzma': 'lzcat'} |
114 |
116 |
115 name_checker = DirectoryChecker |
117 name_checker = DirectoryChecker |
116 |
118 |
117 def __init__(self, filename, encoding): |
119 def __init__(self, filename, encoding): |
118 if encoding and (not self.decoders.has_key(encoding)): |
120 if encoding and (not self.decoders.has_key(encoding)): |
616 ('zip', None, 'zip', 'exe'), |
618 ('zip', None, 'zip', 'exe'), |
617 ('deb', None, 'deb'), |
619 ('deb', None, 'deb'), |
618 ('rpm', None, 'rpm'), |
620 ('rpm', None, 'rpm'), |
619 ('cpio', None, 'cpio'), |
621 ('cpio', None, 'cpio'), |
620 ('gem', None, 'gem'), |
622 ('gem', None, 'gem'), |
621 ('compress', None, 'gz', 'bz2'), |
623 ('compress', None, 'Z', 'gz', 'bz2', 'lzma'), |
622 ('7z', None, '7z')): |
624 ('7z', None, '7z')): |
623 for extension in mapping[2:]: |
625 for extension in mapping[2:]: |
624 extension_map[extension] = mapping[:2] |
626 extension_map[extension] = mapping[:2] |
625 |
627 |
626 def __init__(self, filename, options): |
628 def __init__(self, filename, options): |