os.chdir(source_path)
# for each file to be in the backup, do:
+ i = 0
for path in self._recursive_walk_dir('.'):
+ i += 1
+ if i % 2000 == 0:
+ import gc
+ gc.collect()
+
# calculate stat dict for current file
stat = self._stat_dict(path)
stat['path'] = u'snapshot://' + stat['path']
s = json.dumps(stat) + '\n'
crc = binascii.crc32(s, crc) & 0xffffffff
index_fd.write(s)
+ del stat
s = '{"type": "END-FILE-LIST"}\n'
crc = binascii.crc32(s, crc) & 0xffffffff
if arcname is None:
arcname = name
drv, arcname = os.path.splitdrive(arcname)
- arcname = arcname.replace(os.sep, "/")
+ if os.sep != "/":
+ arcname = arcname.replace(os.sep, "/")
arcname = arcname.lstrip("/")
# Now, fill the TarInfo object with
# The inode is added only if its valid.
# For win32 it is always 0.
type = REGTYPE
- if inode[0]:
+ if inode[0] and self.save_to_members:
self.inodes[inode] = arcname
elif stat.S_ISDIR(stmd):
type = DIRTYPE