I have Python libarchive 0.4.3 installed. I'd like to get the mtime of a 7z file as stored inside the 7z file. This is different than the mtime of the file stored locally on the disk. Let's say it is the underlying source C tarball lzma1604.7z.
The following program will list all of the files and the mtime of that. But I don't see the time for the entire 7z "tarball" as given in the 7z file.
from libarchive.public import memory_reader
with open('lzma1604.7z', 'rb') as f:
buffer = f.read()
with memory_reader(buffer) as archive:
for entry in archive:
print(entry.pathname, entry.mtime)
The above program prints:
('Asm/arm/7zCrcOpt.asm', datetime.datetime(2009, 10, 8, 5, 12))
('Asm/x86/7zAsm.asm', datetime.datetime(2012, 12, 30, 3, 41, 54))
...
('bin/7zSD.sfx', datetime.datetime(2016, 10, 4, 11, 12, 31))
('bin/lzma.exe', datetime.datetime(2016, 10, 4, 11, 12, 30))
('bin/x64/7zr.exe', datetime.datetime(2016, 10, 4, 10, 58, 29))
But if I run 7z l lzma1604.7z
that gives at the end:
2016-10-04 10:12:31 ....A 113152 bin/7zSD.sfx
2016-10-04 10:12:30 ....A 97280 bin/lzma.exe
2016-10-04 09:58:29 ....A 742400 bin/x64/7zr.exe
------------------- ----- ------------ ------------ ------------------------
2016-10-04 10:27:55 4534441 960121 620 files
So how do I get in Python via libarchive the information, specifically, the mtime of the overall archive?