From: Christian Herdtweck Date: Thu, 9 Jun 2016 09:22:58 +0000 (+0200) Subject: warn if trying to compress/encrypt multivolume with mode w:... X-Git-Tag: v2.2~35^2~30 X-Git-Url: http://developer.intra2net.com/git/?a=commitdiff_plain;h=7a2b932929cf5da997fad6a7bab87d89933f45d2;p=python-delta-tar warn if trying to compress/encrypt multivolume with mode w:... --- diff --git a/deltatar/tarfile.py b/deltatar/tarfile.py index 5630761..50dd856 100644 --- a/deltatar/tarfile.py +++ b/deltatar/tarfile.py @@ -1941,6 +1941,13 @@ class TarFile(object): if comptype == 'gz' or comptype == 'bz2': kwargs['compresslevel'] = compresslevel + if 'max_volume_size' in kwargs: + if comptype != 'tar' and filemode in 'wa' \ + and kwargs['max_volume_size']: + import warnings + warnings.warn('Only the first volume will be compressed ' + 'for modes with "w:"!') + return func(name, filemode, fileobj, **kwargs) elif "|" in mode: @@ -2481,6 +2488,7 @@ class TarFile(object): enctype=self.fileobj.enctype, concat_stream=self.fileobj.concat_stream) else: + # here, we lose information about compression/encryption! fileobj = bltn_open(name, self._mode) else: if name is None and hasattr(fileobj, "name"):