rebuild for 10.11+
This commit is contained in:
parent
d989eff547
commit
901b731582
234 changed files with 1522 additions and 927 deletions
|
|
@ -14,6 +14,7 @@
|
|||
# See the README file for information on usage and redistribution.
|
||||
#
|
||||
|
||||
import sys
|
||||
from . import ContainerIO
|
||||
|
||||
|
||||
|
|
@ -30,11 +31,11 @@ class TarIO(ContainerIO.ContainerIO):
|
|||
:param tarfile: Name of TAR file.
|
||||
:param file: Name of member file.
|
||||
"""
|
||||
fh = open(tarfile, "rb")
|
||||
self.fh = open(tarfile, "rb")
|
||||
|
||||
while True:
|
||||
|
||||
s = fh.read(512)
|
||||
s = self.fh.read(512)
|
||||
if len(s) != 512:
|
||||
raise IOError("unexpected end of tar file")
|
||||
|
||||
|
|
@ -50,7 +51,21 @@ class TarIO(ContainerIO.ContainerIO):
|
|||
if file == name:
|
||||
break
|
||||
|
||||
fh.seek((size + 511) & (~511), 1)
|
||||
self.fh.seek((size + 511) & (~511), 1)
|
||||
|
||||
# Open region
|
||||
ContainerIO.ContainerIO.__init__(self, fh, fh.tell(), size)
|
||||
ContainerIO.ContainerIO.__init__(self, self.fh, self.fh.tell(), size)
|
||||
|
||||
# Context manager support
|
||||
def __enter__(self):
|
||||
return self
|
||||
|
||||
def __exit__(self, *args):
|
||||
self.close()
|
||||
|
||||
if sys.version_info.major >= 3:
|
||||
def __del__(self):
|
||||
self.close()
|
||||
|
||||
def close(self):
|
||||
self.fh.close()
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue