|
@@ -29,6 +29,8 @@ import sys |
|
|
import time |
|
|
import time |
|
|
import warnings |
|
|
import warnings |
|
|
|
|
|
|
|
|
|
|
|
from ctypes import cdll, c_char_p |
|
|
|
|
|
|
|
|
from libarchive import _libarchive |
|
|
from libarchive import _libarchive |
|
|
from io import StringIO |
|
|
from io import StringIO |
|
|
|
|
|
|
|
@@ -295,7 +297,7 @@ class EntryWriteStream(object): |
|
|
|
|
|
|
|
|
class Entry(object): |
|
|
class Entry(object): |
|
|
'''An entry within an archive. Represents the header data and it's location within the archive.''' |
|
|
'''An entry within an archive. Represents the header data and it's location within the archive.''' |
|
|
def __init__(self, pathname=None, size=None, mtime=None, mode=None, hpos=None, encoding=ENCODING): |
|
|
|
|
|
|
|
|
def __init__(self, pathname=None, size=None, mtime=None, mode=None, hpos=None, encoding=ENCODING, symlink=None): |
|
|
self.pathname = pathname |
|
|
self.pathname = pathname |
|
|
self.size = size |
|
|
self.size = size |
|
|
self.mtime = mtime |
|
|
self.mtime = mtime |
|
@@ -303,6 +305,11 @@ class Entry(object): |
|
|
self.hpos = hpos |
|
|
self.hpos = hpos |
|
|
self.encoding = encoding |
|
|
self.encoding = encoding |
|
|
|
|
|
|
|
|
|
|
|
if self.issym(): |
|
|
|
|
|
self.symlink = symlink |
|
|
|
|
|
else: |
|
|
|
|
|
self.symlink = None |
|
|
|
|
|
|
|
|
@property |
|
|
@property |
|
|
def header_position(self): |
|
|
def header_position(self): |
|
|
return self.hpos |
|
|
return self.hpos |
|
@@ -328,6 +335,14 @@ class Entry(object): |
|
|
mode=mode, |
|
|
mode=mode, |
|
|
hpos=archive.header_position, |
|
|
hpos=archive.header_position, |
|
|
) |
|
|
) |
|
|
|
|
|
|
|
|
|
|
|
symLinkPath = "" |
|
|
|
|
|
|
|
|
|
|
|
if entry.issym(): |
|
|
|
|
|
libarchive.archive_entry_copy_symlink(e, symLinkPath) |
|
|
|
|
|
|
|
|
|
|
|
print(symLinkPath) |
|
|
|
|
|
|
|
|
finally: |
|
|
finally: |
|
|
_libarchive.archive_entry_free(e) |
|
|
_libarchive.archive_entry_free(e) |
|
|
return entry |
|
|
return entry |
|
|