[Python-checkins] cpython (2.7): Issue #16316: mimetypes now recognizes the .xz and .txz (.tar.xz) extensions.
serhiy.storchaka
python-checkins at python.org
Sat May 4 14:16:53 CEST 2013
http://hg.python.org/cpython/rev/26068bfec70e
changeset: 83599:26068bfec70e
branch: 2.7
parent: 83591:18303391b981
user: Serhiy Storchaka <storchaka at gmail.com>
date: Sat May 04 15:11:46 2013 +0300
summary:
Issue #16316: mimetypes now recognizes the .xz and .txz (.tar.xz) extensions.
files:
Lib/mimetypes.py | 2 ++
Lib/test/test_mimetypes.py | 2 ++
Misc/NEWS | 2 ++
3 files changed, 6 insertions(+), 0 deletions(-)
diff --git a/Lib/mimetypes.py b/Lib/mimetypes.py
--- a/Lib/mimetypes.py
+++ b/Lib/mimetypes.py
@@ -386,12 +386,14 @@
'.taz': '.tar.gz',
'.tz': '.tar.gz',
'.tbz2': '.tar.bz2',
+ '.txz': '.tar.xz',
}
encodings_map = {
'.gz': 'gzip',
'.Z': 'compress',
'.bz2': 'bzip2',
+ '.xz': 'xz',
}
# Before adding new types, make sure they are either registered with IANA,
diff --git a/Lib/test/test_mimetypes.py b/Lib/test/test_mimetypes.py
--- a/Lib/test/test_mimetypes.py
+++ b/Lib/test/test_mimetypes.py
@@ -21,6 +21,8 @@
eq(self.db.guess_type("foo.tgz"), ("application/x-tar", "gzip"))
eq(self.db.guess_type("foo.tar.gz"), ("application/x-tar", "gzip"))
eq(self.db.guess_type("foo.tar.Z"), ("application/x-tar", "compress"))
+ eq(self.db.guess_type("foo.tar.bz2"), ("application/x-tar", "bzip2"))
+ eq(self.db.guess_type("foo.tar.xz"), ("application/x-tar", "xz"))
def test_data_urls(self):
eq = self.assertEqual
diff --git a/Misc/NEWS b/Misc/NEWS
--- a/Misc/NEWS
+++ b/Misc/NEWS
@@ -34,6 +34,8 @@
Library
-------
+- Issue #16316: mimetypes now recognizes the .xz and .txz (.tar.xz) extensions.
+
- Issue #17192: Restore the patch for Issue #10309 which was ommitted
in 2.7.4 when updating the bundled version of libffi used by ctypes.
--
Repository URL: http://hg.python.org/cpython
More information about the Python-checkins
mailing list