Home | History | Annotate | Download | only in python2.7

Lines Matching refs:tarfile

4 # tarfile.py
61 # from tarfile import *
62 __all__ = ["TarFile", "TarInfo", "is_tarfile", "TarError"]
79 LNKTYPE = "1" # link (inside tarfile)
101 # tarfile constants
103 # File types that tarfile supports:
314 Used by TarFile.list()
388 """Class that serves as an adapter between TarFile and
783 Is returned by TarFile.extractfile().
787 def __init__(self, tarfile, tarinfo):
788 self.fileobj = _FileInFile(tarfile.fileobj,
915 TarInfo objects are returned by TarFile.getmember(),
916 TarFile.getmembers() and TarFile.gettarinfo() and are
1235 def fromtarfile(cls, tarfile):
1236 """Return the next TarInfo object from TarFile object
1237 tarfile.
1239 buf = tarfile.fileobj.read(BLOCKSIZE)
1241 obj.offset = tarfile.fileobj.tell() - BLOCKSIZE
1242 return obj._proc_member(tarfile)
1252 # 2. Set tarfile.offset to the position where the next member's header will
1255 def _proc_member(self, tarfile):
1260 return self._proc_gnulong(tarfile)
1262 return self._proc_sparse(tarfile)
1264 return self._proc_pax(tarfile)
1266 return self._proc_builtin(tarfile)
1268 def _proc_builtin(self, tarfile):
1272 self.offset_data = tarfile.fileobj.tell()
1277 tarfile.offset = offset
1281 self._apply_pax_info(tarfile.pax_headers, tarfile.encoding, tarfile.errors)
1285 def _proc_gnulong(self, tarfile):
1289 buf = tarfile.fileobj.read(self._block(self.size))
1293 next = self.fromtarfile(tarfile)
1307 def _proc_sparse(self, tarfile):
1336 buf = tarfile.fileobj.read(BLOCKSIZE)
1357 self.offset_data = tarfile.fileobj.tell()
1358 tarfile.offset = self.offset_data + self._block(self.size)
1363 def _proc_pax(self, tarfile):
1368 buf = tarfile.fileobj.read(self._block(self.size))
1374 pax_headers = tarfile.pax_headers
1376 pax_headers = tarfile.pax_headers.copy()
1401 next = self.fromtarfile(tarfile)
1407 next._apply_pax_info(pax_headers, tarfile.encoding, tarfile.errors)
1417 tarfile.offset = offset
1475 class TarFile(object):
1476 """The TarFile Class provides an interface to tar archives.
1510 `fileobj' is not closed, when TarFile is closed.
1617 # TarFile class. The open() method is the only one that is needed for
1622 # This concept allows one to subclass TarFile without losing the comfort of
1629 an appropriate TarFile class.
1766 # The public methods which TarFile provides:
1769 """Close the TarFile. In write-mode, two finishing zero blocks are
1841 tarinfo.tarfile = self
1964 self._dbg(2, "tarfile: Excluded %r" % name)
1969 self._dbg(2, "tarfile: Skipped %r" % name)
1978 self._dbg(1, "tarfile: Unsupported type %r" % name)
1985 self._dbg(2, "tarfile: Excluded %r" % name)
2064 self._dbg(1, "tarfile: %s" % e)
2090 self._dbg(1, "tarfile: %s" % e.strerror)
2092 self._dbg(1, "tarfile: %s %r" % (e.strerror, e.filename))
2097 self._dbg(1, "tarfile: %s" % e)
2210 self._dbg(1, "tarfile: Unknown file type %r, " \
2305 TarFile is opened for reading. Return None if there is no more
2386 """Check if TarFile is still open, and if the operation's mode
2387 corresponds to TarFile's mode.
2440 # class TarFile
2445 for tarinfo in TarFile(...):
2449 def __init__(self, tarfile):
2452 self.tarfile = tarfile
2459 """Return the next item using TarFile's next() method.
2460 When all members have been read, set TarFile as _loaded.
2466 if self.index == 0 and self.tarfile.firstmember is not None:
2467 tarinfo = self.tarfile.next()
2468 elif self.index < len(self.tarfile.members):
2469 tarinfo = self.tarfile.members[self.index]
2470 elif not self.tarfile._loaded:
2471 tarinfo = self.tarfile.next()
2473 self.tarfile._loaded = True
2524 # zipfile compatible TarFile class
2529 """TarFile class compatible with standard module zipfile's
2537 self.tarfile = TarFile.taropen(file, mode)
2539 self.tarfile = TarFile.gzopen(file, mode)
2543 members = self.tarfile.getmembers()
2552 self.tarfile.getmembers())
2554 self.tarfile.list()
2558 return self.tarfile.getmember(name)
2560 return self.tarfile.extractfile(self.tarfile.getmember(name)).read()
2562 self.tarfile.add(filename, arcname)
2572 self.tarfile.addfile(tinfo, StringIO(bytes))
2574 self.tarfile.close()
2592 open = TarFile.open