def read_tar(f):
result = {}
try:
with tarfile.open(f) as t:
for m in t:
if m.isfile():
f = t.extractfile(m)
sha512 = sha512_file(f)
else:
sha512 = None
result[m.name] = TarMemberInfo(m, sha512)
except tarfile.ReadError:
# if we can't read the tar archive, we should never consider it to have
# the same contents as another tar archive...
result[f] = None
return result
#
#
#
评论列表
文章目录