Codebase list dtrx / a17df1c
Import Upstream version 6.6 Dmitry Bogatov 5 years ago
8 changed file(s) with 48 addition(s) and 17 deletion(s). Raw diff Collapse all Expand all
5353 Files compressed with lzma
5454 lzcat
5555
56 Files compressed with xz
57 xzcat
58
5659 Installation
5760 ------------
5861
7275
7376 python tests/compare.py
7477
75 To run the tests, you'll need the `syck module`_.
78 To run the tests, you'll need the `PyYAML module`_.
7679
77 .. _syck module: http://whytheluckystiff.net/syck/
80 .. _PyYAML module: http://pyyaml.org/
7881
7982 If everything's in order, all the tests should pass. Note that some of
8083 them will fail if some of the programs listed above aren't installed on
00 Changes in dtrx
11 ===============
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.
218
319 Version 6.5
420 -----------
00 Metadata-Version: 1.0
11 Name: dtrx
2 Version: 6.5
2 Version: 6.6
33 Summary: Script to intelligently extract multiple archive types
44 Home-page: http://www.brettcsmith.org/2007/dtrx/
55 Author: Brett Smith
1010 formats; it currently supports tar, zip (including self-extracting
1111 .exe files), cpio, rpm, deb, gem, 7z, cab, rar, and InstallShield
1212 files. It can also decompress files compressed with gzip, bzip2,
13 lzma, or compress.
13 lzma, xz, or compress.
1414
1515 In addition to providing one command to handle many different archive
1616 types, dtrx also aids the user by extracting contents consistently.
4343 except NameError:
4444 from sets import Set as set
4545
46 VERSION = "6.5"
46 VERSION = "6.6"
4747 VERSION_BANNER = """dtrx version %s
4848 Copyright © 2006-2009 Brett Smith <brettcsmith@brettcsmith.org>
4949 Copyright © 2008 Peter Kelemen <Peter.Kelemen@gmail.com>
7979
8080 mimetypes.encodings_map.setdefault('.bz2', 'bzip2')
8181 mimetypes.encodings_map.setdefault('.lzma', 'lzma')
82 mimetypes.encodings_map.setdefault('.xz', 'xz')
8283 mimetypes.types_map.setdefault('.gem', 'application/x-ruby-gem')
8384
8485 logger = logging.getLogger('dtrx-log')
137138
138139 class BaseExtractor(object):
139140 decoders = {'bzip2': 'bzcat', 'gzip': 'zcat', 'compress': 'zcat',
140 'lzma': 'lzcat'}
141 'lzma': 'lzcat', 'xz': 'xzcat'}
141142 name_checker = DirectoryChecker
142143
143144 def __init__(self, filename, encoding):
883884 for mapping in (('tar', 'bzip2', 'tar.bz2', 'tbz2', 'tb2', 'tbz'),
884885 ('tar', 'gzip', 'tar.gz', 'tgz'),
885886 ('tar', 'lzma', 'tar.lzma', 'tlz'),
887 ('tar', 'xz', 'tar.xz'),
886888 ('tar', 'compress', 'tar.Z', 'taz'),
887889 ('compress', 'gzip', 'Z', 'gz'),
888890 ('compress', 'bzip2', 'bz2'),
889 ('compress', 'lzma', 'lzma')):
891 ('compress', 'lzma', 'lzma'),
892 ('compress', 'xz', 'xz')):
890893 for extension in mapping[2:]:
891894 extension_map.setdefault(extension, []).append(mapping[:2])
892895
893896 magic_encoding_map = {}
894897 for mapping in (('bzip2', 'bzip2 compressed'),
895898 ('gzip', 'gzip compressed'),
896 ('lzma', 'LZMA compressed')):
899 ('lzma', 'LZMA compressed'),
900 ('xz', 'xz compressed')):
897901 for pattern in mapping[1:]:
898902 magic_encoding_map[re.compile(pattern)] = mapping[0]
899903
22 from distutils.core import setup
33
44 setup(name="dtrx",
5 version = "6.5",
5 version = "6.6",
66 description = "Script to intelligently extract multiple archive types",
77 author = "Brett Smith",
88 author_email = "brettcsmith@brettcsmith.org",
2323 formats; it currently supports tar, zip (including self-extracting
2424 .exe files), cpio, rpm, deb, gem, 7z, cab, rar, and InstallShield
2525 files. It can also decompress files compressed with gzip, bzip2,
26 lzma, or compress.
26 lzma, xz, or compress.
2727
2828 In addition to providing one command to handle many different archive
2929 types, dtrx also aids the user by extracting contents consistently.
1919 import os
2020 import re
2121 import subprocess
22 import syck
22 import yaml
2323 import sys
2424 import tempfile
2525
219219
220220
221221 test_db = open('tests.yml')
222 test_data = syck.load(test_db.read(-1))
222 test_data = yaml.load(test_db.read(-1))
223223 test_db.close()
224224 tests = [ExtractorTest(**data) for data in test_data]
225225 for original_data in test_data:
Binary diff not shown
106106 posttest: |
107107 if [ "x`cat test-text`" != "xhi" ]; then exit 1; fi
108108
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
109117 - name: decompression with -r
110118 directory: inside-dir
111119 filenames: ../test-text.gz
190198 filenames: tests.yml
191199 options: -n -qq
192200 error: true
193 antigrep: .
201 antigrep: '.'
194202
195203 - name: can't write to directory
196204 directory: inside-dir
460468 input: |
461469 h
462470 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\)'
464472 baseline: |
465473 tar -xf $1
466474 cd subdir
510518 filenames: trickery.tar.gz
511519 prerun: cp ${1}test-1.23.zip ${1}trickery.tar.gz
512520 cleanup: rm -f ${1}trickery.tar.gz
513 antigrep: .
521 antigrep: '.'
514522 baseline: |
515523 mkdir trickery
516524 cd trickery
645653 r
646654 l
647655 n
648 grep: "^test-deep-recursion/subsubdir/test-text\.gz$"
656 grep: '^test-deep-recursion/subsubdir/test-text\.gz$'
649657
650658 - name: partly failed extraction
651659 options: -n
681689 - name: listing empty archive
682690 filenames: test-empty.tar.bz2
683691 options: -l
684 antigrep: .
692 antigrep: '.'