git://developer.intra2net.com
/
python-delta-tar
/ commitdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
| commitdiff |
tree
raw
|
patch
(parent:
b0aef80
)
Pass on 'compresslevel' for gzip / bzip2 compressed archives only
author
Thomas Jarosch
<thomas.jarosch@intra2net.com>
Fri, 3 Jul 2015 14:35:57 +0000 (16:35 +0200)
committer
Thomas Jarosch
<thomas.jarosch@intra2net.com>
Fri, 3 Jul 2015 14:38:46 +0000 (16:38 +0200)
Otherwise we crash when opening plain tar files for writing:
TypeError: taropen() takes from 2 to 4 positional arguments but 5 were given
First part of the unit test fix. Verified with debug statements
in gzopen() that passing on the parameter still works.
deltatar/tarfile.py
patch
|
blob
|
blame
|
history
diff --git
a/deltatar/tarfile.py
b/deltatar/tarfile.py
index
356b154
..
729079f
100644
(file)
--- a/
deltatar/tarfile.py
+++ b/
deltatar/tarfile.py
@@
-1908,7
+1908,12
@@
class TarFile(object):
func = getattr(cls, cls.OPEN_METH[comptype])
else:
raise CompressionError("unknown compression type %r" % comptype)
- return func(name, filemode, fileobj, compresslevel, **kwargs)
+
+ # Pass on compression level for gzip / bzip2.
+ if comptype == 'gz' or comptype == 'bz2':
+ kwargs['compresslevel'] = compresslevel
+
+ return func(name, filemode, fileobj, **kwargs)
elif "|" in mode:
filemode, comptype = mode.split("|", 1)