def __del__(self):
if hasattr(self, "closed") and not self.closed:
self.close()
- #if self.encryption is not None:
- # print("crypto: %s"
- # % (self.encryption.currentstate () == crypto.STATE_DEAD
- # and "inactive" or "active"))
- # print("crypto: %d objects handled, %d B in, %d B out"
- # % self.encryption.counters ())
def _init_write_encrypt (self, entry=None):
You can create TarInfo objects using gettarinfo().
On Windows platforms, `fileobj' should always be opened with mode
'rb' to avoid irritation about the file size.
-
- Encryption restarts with each volume. Compression restarts with each
- file and may span volumes.
"""
self._check("aw")
# another one; otherwise, the encryption must include the block
# padding below.
if getattr (self.fileobj, "encryption", None) is not None:
- self.fileobj._finalize_write_encrypt ()
+ self.fileobj.close (close_fileobj=True)
tarinfo.type = GNUTYPE_MULTIVOL
if getattr (self.fileobj, "encryption", None) is not None:
self.fileobj._init_write_encrypt (tarinfo.name)
+ if self.concat_compression:
+ self.fileobj.new_compression_block()
# write new volume header
buf = tarinfo.tobuf(self.format, self.encoding, self.errors)
if self.save_to_members:
self.members.append(tarinfo)
- def open_volume(self, name="", fileobj=None):
+ def open_volume(self, name="", fileobj=None, encryption=None):
'''
Called by the user to change this tar file to point to a new volume.
'''
comptype=self.fileobj.comptype,
fileobj=None,
bufsize=self.fileobj.bufsize,
- encryption=self.encryption,
+ encryption=encryption,
concat_stream=self.fileobj.concat_stream)
else:
# here, we lose information about compression/encryption!