Skip to content
Snippets Groups Projects
Commit 3111893c authored by anthraxx's avatar anthraxx
Browse files

libarchive: add compatibility with python-libarchive >= 2.8

Python librarchive 2.8 removed the mtime_nsec property from
ArchiveEntry so lets wire the ffi function if available
parent 6eac9f69
No related branches found
No related tags found
No related merge requests found
......@@ -80,6 +80,11 @@ if not hasattr(libarchive.ffi, 'entry_gname'):
'entry_gname', [libarchive.ffi.c_archive_entry_p], ctypes.c_char_p)
libarchive.ArchiveEntry.gname = property(
lambda self: libarchive.ffi.entry_gname(self._entry_p))
# Monkeypatch libarchive-c (<< 2.8)
if not hasattr(libarchive.ArchiveEntry, 'mtime_nsec') and hasattr(libarchive.ffi, 'entry_mtime_nsec'):
libarchive.ArchiveEntry.mtime_nsec = property(
lambda self: libarchive.ffi.entry_mtime_nsec(self._entry_p))
# Monkeypatch libarchive-c so we always get pathname as (Unicode) str
# Otherwise, we'll get sometimes str and sometimes bytes and always pain.
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment