createrepo/utils.py

[email protected] Wed, 26 Oct 2011 17:37:47 +0000 (UTC)
Newsgroups gmane.linux.rpm.metadata
Message-ID <[email protected]>
 createrepo/utils.py |    2 ++
 1 file changed, 2 insertions(+)

New commits:
commit 106a24e1784f1b0c611bc80110f003f464c20c1b
Author: Seth Vidal <[email protected]>
Date:   Wed Oct 26 13:37:05 2011 -0400

    if we have to guess the compression type from filename - check to see if we
    can support it. If we can't, fallback to gzip.

diff --git a/createrepo/utils.py b/createrepo/utils.py
index c816640..c5cec64 100644
--- a/createrepo/utils.py
+++ b/createrepo/utils.py
@@ -124,6 +124,8 @@ def compressOpen(fn, mode='rb', compress_type=None):
     if not compress_type:
         # we are readonly and we don't give a compress_type - then guess based on the file extension
         compress_type = fn.split('.')[-1]
+        if compress_type not in _available_compression:
+            compress_type = 'gz'
             
     if compress_type == 'xz':
         return lzma.LZMAFile(fn, mode)