Lines Matching refs:tarfile

3 # tarfile.py
69 # from tarfile import *
91 LNKTYPE = b"1" # link (inside tarfile)
113 # tarfile constants
115 # File types that tarfile supports:
710 def __init__(self, tarfile, tarinfo):
711 fileobj = _FileInFile(tarfile.fileobj, tarinfo.offset_data,
870 tarfile = None,
1284 def fromtarfile(cls, tarfile):
1286 tarfile.
1288 buf = tarfile.fileobj.read(BLOCKSIZE)
1289 obj = cls.frombuf(buf, tarfile.encoding, tarfile.errors)
1290 obj.offset = tarfile.fileobj.tell() - BLOCKSIZE
1291 return obj._proc_member(tarfile)
1301 # 2. Set tarfile.offset to the position where the next member's header will
1304 def _proc_member(self, tarfile):
1309 return self._proc_gnulong(tarfile)
1311 return self._proc_sparse(tarfile)
1313 return self._proc_pax(tarfile)
1315 return self._proc_builtin(tarfile)
1317 def _proc_builtin(self, tarfile):
1321 self.offset_data = tarfile.fileobj.tell()
1326 tarfile.offset = offset
1330 self._apply_pax_info(tarfile.pax_headers, tarfile.encoding, tarfile.errors)
1339 def _proc_gnulong(self, tarfile):
1343 buf = tarfile.fileobj.read(self._block(self.size))
1347 next = self.fromtarfile(tarfile)
1355 next.name = nts(buf, tarfile.encoding, tarfile.errors)
1357 next.linkname = nts(buf, tarfile.encoding, tarfile.errors)
1366 def _proc_sparse(self, tarfile):
1375 buf = tarfile.fileobj.read(BLOCKSIZE)
1389 self.offset_data = tarfile.fileobj.tell()
1390 tarfile.offset = self.offset_data + self._block(self.size)
1394 def _proc_pax(self, tarfile):
1399 buf = tarfile.fileobj.read(self._block(self.size))
1405 pax_headers = tarfile.pax_headers
1407 pax_headers = tarfile.pax_headers.copy()
1447 # the initial behavior of the 'tarfile' module.
1450 encoding = tarfile.encoding
1470 tarfile.errors)
1472 value = self._decode_pax_field(raw_value, encoding, tarfile.encoding,
1473 tarfile.errors)
1476 tarfile.errors)
1482 next = self.fromtarfile(tarfile)
1497 self._proc_gnusparse_10(next, pax_headers, tarfile)
1501 next._apply_pax_info(pax_headers, tarfile.encoding, tarfile.errors)
1511 tarfile.offset = offset
1541 def _proc_gnusparse_10(self, next, pax_headers, tarfile):
1546 buf = tarfile.fileobj.read(BLOCKSIZE)
1551 buf += tarfile.fileobj.read(BLOCKSIZE)
1554 next.offset_data = tarfile.fileobj.tell()
1793 'x' or 'x:' create a tarfile exclusively without compression, raise
1795 'x:gz' create a gzip compressed tarfile, raise an exception
1797 'x:bz2' create a bzip2 compressed tarfile, raise an exception
1799 'x:xz' create an lzma compressed tarfile, raise an exception
2054 tarinfo.tarfile = self # Not needed
2180 self._dbg(2, "tarfile: Skipped %r" % name)
2189 self._dbg(1, "tarfile: Unsupported type %r" % name)
2196 self._dbg(2, "tarfile: Excluded %r" % name)
2248 + 'tarfile.data_filter directly.')
2336 self._dbg(2, "tarfile: Excluded %r" % unfiltered.name)
2362 self._dbg(1, "tarfile: %s" % e)
2370 self._dbg(1, "tarfile: %s" % e.strerror)
2372 self._dbg(1, "tarfile: %s %r" % (e.strerror, e.filename))
2374 self._dbg(1, "tarfile: %s %s" % (type(e).__name__, e))
2492 self._dbg(1, "tarfile: Unknown file type %r, " \
2825 description = 'A simple command-line interface for tarfile module.'
2834 group.add_argument('-l', '--list', metavar='<tarfile>',
2835 help='Show listing of a tarfile')
2837 metavar=('<tarfile>', '<output_dir>'),
2838 help='Extract tarfile into target dir')
2841 help='Create tarfile from sources')
2842 group.add_argument('-t', '--test', metavar='<tarfile>',
2843 help='Test if a tarfile is valid')