"""Read from and write to tar format archives.
"""
-I2N_XXX_ENCRYPTION_VERSION = 0
+I2N_XXX_ENCRYPTION_VERSION = 1
__version__ = "$Revision: 85213 $"
# $Source$
self.name = name or ""
self.mode = mode
self.comptype = comptype
+ self.cmp = None
self.fileobj = fileobj
self.bufsize = bufsize
self.buf = b""
("ctor failed crypto.Encrypt(<PASSWORD>, ā%sā, %r)"
% (nacl, 1))
self.encryption = enc
- self._init_write_gz()
+ #self._init_write_gz()
self.exception = zlib.error # XXX what for? seems unused
self.crc = zlib.crc32(b"") & 0xFFFFffff
self.crc = self.zlib.crc32(s, self.crc) & 0xFFFFffff
self.pos += len(s)
self.concat_pos += len(s)
- if self.comptype != "tar":
+ if self.cmp is not None:
s = self.cmp.compress(s)
self.__write(s)
given, the streem will seek to that position first and back afterwards,
and the total of bytes written is not updated.
'''
- % (len (s),
- ("" if pos is None else (" at 0x%x" % pos))))
if pos is not None:
self.fileobj
p0 = self.fileobj.tell ()
if self.closed:
return
- if self.mode == "w" and self.comptype != "tar":
+ if self.mode == "w" and self.cmp is not None:
self.buf += self.cmp.flush()
if self.mode == "w" and self.buf:
if not buf:
break
- if self.comptype != "tar":
+ if self.cmp is not None:
try:
buf = self.cmp.decompress(buf)
except IOError: