Home | History | Annotate | Download | only in Lib

Lines Matching refs:TarFile

3 # 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
795 Is returned by TarFile.extractfile().
799 def __init__(self, tarfile, tarinfo):
800 self.fileobj = _FileInFile(tarfile.fileobj,
927 TarInfo objects are returned by TarFile.getmember(),
928 TarFile.getmembers() and TarFile.gettarinfo() and are
1247 def fromtarfile(cls, tarfile):
1248 """Return the next TarInfo object from TarFile object
1249 tarfile.
1251 buf = tarfile.fileobj.read(BLOCKSIZE)
1253 obj.offset = tarfile.fileobj.tell() - BLOCKSIZE
1254 return obj._proc_member(tarfile)
1264 # 2. Set tarfile.offset to the position where the next member's header will
1267 def _proc_member(self, tarfile):
1272 return self._proc_gnulong(tarfile)
1274 return self._proc_sparse(tarfile)
1276 return self._proc_pax(tarfile)
1278 return self._proc_builtin(tarfile)
1280 def _proc_builtin(self, tarfile):
1284 self.offset_data = tarfile.fileobj.tell()
1289 tarfile.offset = offset
1293 self._apply_pax_info(tarfile.pax_headers, tarfile.encoding, tarfile.errors)
1297 def _proc_gnulong(self, tarfile):
1301 buf = tarfile.fileobj.read(self._block(self.size))
1305 next = self.fromtarfile(tarfile)
1319 def _proc_sparse(self, tarfile):
1348 buf = tarfile.fileobj.read(BLOCKSIZE)
1369 self.offset_data = tarfile.fileobj.tell()
1370 tarfile.offset = self.offset_data + self._block(self.size)
1375 def _proc_pax(self, tarfile):
1380 buf = tarfile.fileobj.read(self._block(self.size))
1386 pax_headers = tarfile.pax_headers
1388 pax_headers = tarfile.pax_headers.copy()
1413 next = self.fromtarfile(tarfile)
1419 next._apply_pax_info(pax_headers, tarfile.encoding, tarfile.errors)
1429 tarfile.offset = offset
1487 class TarFile(object):
1488 """The TarFile Class provides an interface to tar archives.
1522 `fileobj' is not closed, when TarFile is closed.
1630 # TarFile class. The open() method is the only one that is needed for
1635 # This concept allows one to subclass TarFile without losing the comfort of
1642 an appropriate TarFile class.
1798 # The public methods which TarFile provides:
1801 """Close the TarFile. In write-mode, two finishing zero blocks are
1875 tarinfo.tarfile = self # Not needed
1998 self._dbg(2, "tarfile: Excluded %r" % name)
2003 self._dbg(2, "tarfile: Skipped %r" % name)
2012 self._dbg(1, "tarfile: Unsupported type %r" % name)
2019 self._dbg(2, "tarfile: Excluded %r" % name)
2098 self._dbg(1, "tarfile: %s" % e)
2124 self._dbg(1, "tarfile: %s" % e.strerror)
2126 self._dbg(1, "tarfile: %s %r" % (e.strerror, e.filename))
2131 self._dbg(1, "tarfile: %s" % e)
2244 self._dbg(1, "tarfile: Unknown file type %r, " \
2339 TarFile is opened for reading. Return None if there is no more
2425 """Check if TarFile is still open, and if the operation's mode
2426 corresponds to TarFile's mode.
2479 # class TarFile
2484 for tarinfo in TarFile(...):
2488 def __init__(self, tarfile):
2491 self.tarfile = tarfile
2498 """Return the next item using TarFile's next() method.
2499 When all members have been read, set TarFile as _loaded.
2505 if self.index == 0 and self.tarfile.firstmember is not None:
2506 tarinfo = self.tarfile.next()
2507 elif self.index < len(self.tarfile.members):
2508 tarinfo = self.tarfile.members[self.index]
2509 elif not self.tarfile._loaded:
2510 tarinfo = self.tarfile.next()
2512 self.tarfile._loaded = True
2563 # zipfile compatible TarFile class
2568 """TarFile class compatible with standard module zipfile's
2576 self.tarfile = TarFile.taropen(file, mode)
2578 self.tarfile = TarFile.gzopen(file, mode)
2582 members = self.tarfile.getmembers()
2591 self.tarfile.getmembers())
2593 self.tarfile.list()
2597 return self.tarfile.getmember(name)
2599 return self.tarfile.extractfile(self.tarfile.getmember(name)).read()
2601 self.tarfile.add(filename, arcname)
2611 self.tarfile.addfile(tinfo, StringIO(bytes))
2613 self.tarfile.close()
2630 open = TarFile.open