Import Upstream version 6.6
Dmitry Bogatov
5 years ago
53 | 53 | Files compressed with lzma |
54 | 54 | lzcat |
55 | 55 | |
56 | Files compressed with xz | |
57 | xzcat | |
58 | ||
56 | 59 | Installation |
57 | 60 | ------------ |
58 | 61 | |
72 | 75 | |
73 | 76 | python tests/compare.py |
74 | 77 | |
75 | To run the tests, you'll need the `syck module`_. | |
78 | To run the tests, you'll need the `PyYAML module`_. | |
76 | 79 | |
77 | .. _syck module: http://whytheluckystiff.net/syck/ | |
80 | .. _PyYAML module: http://pyyaml.org/ | |
78 | 81 | |
79 | 82 | If everything's in order, all the tests should pass. Note that some of |
80 | 83 | them will fail if some of the programs listed above aren't installed on |
0 | 0 | Changes in dtrx |
1 | 1 | =============== |
2 | ||
3 | Version 6.6 | |
4 | ----------- | |
5 | ||
6 | Enhancements | |
7 | ~~~~~~~~~~~~ | |
8 | ||
9 | * dtrx can now handle `xz compression`_. | |
10 | ||
11 | .. _xz compression: http://tukaani.org/xz/ | |
12 | ||
13 | Other changes | |
14 | ~~~~~~~~~~~~~ | |
15 | ||
16 | * The tests now use the PyYAML library, instead of the abandoned Syck. | |
17 | Thanks to Miguelangel Jose Freitas Loreto for a patch. | |
2 | 18 | |
3 | 19 | Version 6.5 |
4 | 20 | ----------- |
0 | 0 | Metadata-Version: 1.0 |
1 | 1 | Name: dtrx |
2 | Version: 6.5 | |
2 | Version: 6.6 | |
3 | 3 | Summary: Script to intelligently extract multiple archive types |
4 | 4 | Home-page: http://www.brettcsmith.org/2007/dtrx/ |
5 | 5 | Author: Brett Smith |
10 | 10 | formats; it currently supports tar, zip (including self-extracting |
11 | 11 | .exe files), cpio, rpm, deb, gem, 7z, cab, rar, and InstallShield |
12 | 12 | files. It can also decompress files compressed with gzip, bzip2, |
13 | lzma, or compress. | |
13 | lzma, xz, or compress. | |
14 | 14 | |
15 | 15 | In addition to providing one command to handle many different archive |
16 | 16 | types, dtrx also aids the user by extracting contents consistently. |
43 | 43 | except NameError: |
44 | 44 | from sets import Set as set |
45 | 45 | |
46 | VERSION = "6.5" | |
46 | VERSION = "6.6" | |
47 | 47 | VERSION_BANNER = """dtrx version %s |
48 | 48 | Copyright © 2006-2009 Brett Smith <brettcsmith@brettcsmith.org> |
49 | 49 | Copyright © 2008 Peter Kelemen <Peter.Kelemen@gmail.com> |
79 | 79 | |
80 | 80 | mimetypes.encodings_map.setdefault('.bz2', 'bzip2') |
81 | 81 | mimetypes.encodings_map.setdefault('.lzma', 'lzma') |
82 | mimetypes.encodings_map.setdefault('.xz', 'xz') | |
82 | 83 | mimetypes.types_map.setdefault('.gem', 'application/x-ruby-gem') |
83 | 84 | |
84 | 85 | logger = logging.getLogger('dtrx-log') |
137 | 138 | |
138 | 139 | class BaseExtractor(object): |
139 | 140 | decoders = {'bzip2': 'bzcat', 'gzip': 'zcat', 'compress': 'zcat', |
140 | 'lzma': 'lzcat'} | |
141 | 'lzma': 'lzcat', 'xz': 'xzcat'} | |
141 | 142 | name_checker = DirectoryChecker |
142 | 143 | |
143 | 144 | def __init__(self, filename, encoding): |
883 | 884 | for mapping in (('tar', 'bzip2', 'tar.bz2', 'tbz2', 'tb2', 'tbz'), |
884 | 885 | ('tar', 'gzip', 'tar.gz', 'tgz'), |
885 | 886 | ('tar', 'lzma', 'tar.lzma', 'tlz'), |
887 | ('tar', 'xz', 'tar.xz'), | |
886 | 888 | ('tar', 'compress', 'tar.Z', 'taz'), |
887 | 889 | ('compress', 'gzip', 'Z', 'gz'), |
888 | 890 | ('compress', 'bzip2', 'bz2'), |
889 | ('compress', 'lzma', 'lzma')): | |
891 | ('compress', 'lzma', 'lzma'), | |
892 | ('compress', 'xz', 'xz')): | |
890 | 893 | for extension in mapping[2:]: |
891 | 894 | extension_map.setdefault(extension, []).append(mapping[:2]) |
892 | 895 | |
893 | 896 | magic_encoding_map = {} |
894 | 897 | for mapping in (('bzip2', 'bzip2 compressed'), |
895 | 898 | ('gzip', 'gzip compressed'), |
896 | ('lzma', 'LZMA compressed')): | |
899 | ('lzma', 'LZMA compressed'), | |
900 | ('xz', 'xz compressed')): | |
897 | 901 | for pattern in mapping[1:]: |
898 | 902 | magic_encoding_map[re.compile(pattern)] = mapping[0] |
899 | 903 |
2 | 2 | from distutils.core import setup |
3 | 3 | |
4 | 4 | setup(name="dtrx", |
5 | version = "6.5", | |
5 | version = "6.6", | |
6 | 6 | description = "Script to intelligently extract multiple archive types", |
7 | 7 | author = "Brett Smith", |
8 | 8 | author_email = "brettcsmith@brettcsmith.org", |
23 | 23 | formats; it currently supports tar, zip (including self-extracting |
24 | 24 | .exe files), cpio, rpm, deb, gem, 7z, cab, rar, and InstallShield |
25 | 25 | files. It can also decompress files compressed with gzip, bzip2, |
26 | lzma, or compress. | |
26 | lzma, xz, or compress. | |
27 | 27 | |
28 | 28 | In addition to providing one command to handle many different archive |
29 | 29 | types, dtrx also aids the user by extracting contents consistently. |
19 | 19 | import os |
20 | 20 | import re |
21 | 21 | import subprocess |
22 | import syck | |
22 | import yaml | |
23 | 23 | import sys |
24 | 24 | import tempfile |
25 | 25 | |
219 | 219 | |
220 | 220 | |
221 | 221 | test_db = open('tests.yml') |
222 | test_data = syck.load(test_db.read(-1)) | |
222 | test_data = yaml.load(test_db.read(-1)) | |
223 | 223 | test_db.close() |
224 | 224 | tests = [ExtractorTest(**data) for data in test_data] |
225 | 225 | for original_data in test_data: |
Binary diff not shown
106 | 106 | posttest: | |
107 | 107 | if [ "x`cat test-text`" != "xhi" ]; then exit 1; fi |
108 | 108 | |
109 | - name: decompressing xz | |
110 | directory: inside-dir | |
111 | filenames: ../test-text.xz | |
112 | baseline: | | |
113 | xzcat $1 >test-text | |
114 | posttest: | | |
115 | if [ "x`cat test-text`" != "xhi" ]; then exit 1; fi | |
116 | ||
109 | 117 | - name: decompression with -r |
110 | 118 | directory: inside-dir |
111 | 119 | filenames: ../test-text.gz |
190 | 198 | filenames: tests.yml |
191 | 199 | options: -n -qq |
192 | 200 | error: true |
193 | antigrep: . | |
201 | antigrep: '.' | |
194 | 202 | |
195 | 203 | - name: can't write to directory |
196 | 204 | directory: inside-dir |
460 | 468 | input: | |
461 | 469 | h |
462 | 470 | o |
463 | grep: "contains 2 other archive file\(s\), out of 2 file\(s\)" | |
471 | grep: 'contains 2 other archive file\(s\), out of 2 file\(s\)' | |
464 | 472 | baseline: | |
465 | 473 | tar -xf $1 |
466 | 474 | cd subdir |
510 | 518 | filenames: trickery.tar.gz |
511 | 519 | prerun: cp ${1}test-1.23.zip ${1}trickery.tar.gz |
512 | 520 | cleanup: rm -f ${1}trickery.tar.gz |
513 | antigrep: . | |
521 | antigrep: '.' | |
514 | 522 | baseline: | |
515 | 523 | mkdir trickery |
516 | 524 | cd trickery |
645 | 653 | r |
646 | 654 | l |
647 | 655 | n |
648 | grep: "^test-deep-recursion/subsubdir/test-text\.gz$" | |
656 | grep: '^test-deep-recursion/subsubdir/test-text\.gz$' | |
649 | 657 | |
650 | 658 | - name: partly failed extraction |
651 | 659 | options: -n |
681 | 689 | - name: listing empty archive |
682 | 690 | filenames: test-empty.tar.bz2 |
683 | 691 | options: -l |
684 | antigrep: . | |
692 | antigrep: '.' |