• Home
  • Raw
  • Download

Lines Matching refs:tar

92         self.tar = tarfile.open(self.tarname, mode=self.mode,
96 self.tar.close()
102 tarinfo = self.tar.getmember("ustar/regtype")
103 with self.tar.extractfile(tarinfo) as fobj:
111 self.tar.extract("ustar/regtype", TEMPDIR)
112 tarinfo = self.tar.getmember("ustar/regtype")
116 with self.tar.extractfile(tarinfo) as fobj:
129 self.tar.extract("ustar/regtype", TEMPDIR)
130 tarinfo = self.tar.getmember("ustar/regtype")
133 with self.tar.extractfile(tarinfo) as fobj2:
139 self.tar.extract("ustar/regtype", TEMPDIR)
143 tarinfo = self.tar.getmember("ustar/regtype")
144 with self.tar.extractfile(tarinfo) as fobj:
187 with self.tar.extractfile("ustar/regtype") as fobj:
202 with self.tar.extractfile(lnktype) as a, \
203 self.tar.extractfile(regtype) as b:
237 self.tar = tarfile.open(self.tarname, mode=self.mode)
242 self.tar.list(verbose=False)
255 s = b.decode(self.tar.encoding, 'surrogateescape')
279 self.tar.list(verbose=True)
302 def members(tar): argument
303 for tarinfo in tar.getmembers():
307 self.tar.list(verbose=False, members=members(self.tar))
367 tar = tarfile.open(tmpname, self.mode)
368 tar.getnames()
372 self.assertListEqual(tar.getmembers(), [])
374 tar.close()
405 tar = tarfile.open(tmpname, mode="r", ignore_zeros=True)
407 self.assertListEqual(tar.getnames(), ["foo"],
411 tar.close()
415 with tarfile.open(tmpname, "w:") as tar:
418 tar.addfile(t, io.BytesIO(b"a" * 1024))
423 with tarfile.open(tmpname) as tar:
425 for t in tar:
428 with tarfile.open(tmpname) as tar:
429 t = tar.next()
432 tar.extract(t, TEMPDIR)
435 tar.extractfile(t).read()
441 with tarfile.open(support.findfile('recursion.tar')) as tar:
452 with tarfile.open(fileobj=fobj, mode=self.mode) as tar:
453 self.assertIsInstance(tar.name, str)
454 self.assertEqual(tar.name, os.path.abspath(fobj.name))
461 tar = tarfile.open(fileobj=fobj, mode=self.mode)
462 self.assertIsNone(tar.name)
469 with tarfile.open(fileobj=fobj, mode=self.mode) as tar:
470 self.assertIsNone(tar.name)
478 with tarfile.open(fileobj=fobj, mode=self.mode) as tar:
479 self.assertIsNone(tar.name)
486 with tarfile.open(fileobj=fobj, mode=self.mode) as tar:
487 self.assertIsInstance(tar.name, bytes)
488 self.assertEqual(tar.name, os.path.abspath(fobj.name))
492 with tarfile.open(tarname, mode=self.mode) as tar:
493 self.assertIsInstance(tar.name, str)
494 self.assertEqual(tar.name, os.path.abspath(os.fspath(tarname)))
495 with self.taropen(tarname) as tar:
496 self.assertIsInstance(tar.name, str)
497 self.assertEqual(tar.name, os.path.abspath(os.fspath(tarname)))
498 with tarfile.TarFile.open(tarname, mode=self.mode) as tar:
499 self.assertIsInstance(tar.name, str)
500 self.assertEqual(tar.name, os.path.abspath(os.fspath(tarname)))
502 with tarfile.TarFile(tarname, mode='r') as tar:
503 self.assertIsInstance(tar.name, str)
504 self.assertEqual(tar.name, os.path.abspath(os.fspath(tarname)))
510 tar = self.taropen(tmpname, 'q')
512 tar = self.taropen(tmpname, 'rw')
514 tar = self.taropen(tmpname, '')
519 tar = tarfile.open(self.tarname, mode=self.mode)
521 tar.next()
522 t = tar.next()
525 with tar.extractfile(t) as f:
528 tar.close()
535 with tar.open(self.tarname, mode="r:", fileobj=fobj) as tar:
536 t = tar.next()
540 tar.getmembers()
541 self.assertEqual(tar.extractfile(t).read(), data,
555 tarinfo = self.tar.getmember("misc/dirtype-old-v7")
564 self.tar.getmember("misc/regtype-xstar")
569 for tarinfo in self.tar:
578 self.assertEqual(self.tar.getmembers()[-1].name, "misc/eof",
586 with tarfile.open(tarname, errorlevel=1, encoding="iso8859-1") as tar:
587 tar.extract("ustar/regtype", TEMPDIR)
590 tar.extract("ustar/lnktype", TEMPDIR)
596 tar.extract("ustar/symtype", TEMPDIR)
605 tar = tarfile.open(tarname, encoding="iso8859-1")
609 directories = [t for t in tar if t.isdir()]
610 tar.extractall(DIR, directories)
629 tar.close()
637 with tarfile.open(tarname, encoding="iso8859-1") as tar:
638 tarinfo = tar.getmember(dirtype)
639 tar.extract(tarinfo, path=DIR)
650 tarfile.open(tarname, encoding="iso8859-1") as tar:
651 directories = [t for t in tar if t.isdir()]
652 tar.extractall(DIR, directories)
661 tarfile.open(tarname, encoding="iso8859-1") as tar:
662 tarinfo = tar.getmember(dirtype)
663 tar.extract(tarinfo, path=DIR)
676 tar = object.__new__(tarfile.TarFile)
678 tar.__init__(empty)
680 self.assertTrue(tar.fileobj.closed)
689 with tarfile.open(self.tarname) as tar:
690 for m1, m2 in zip(tar, tar):
726 for tarinfo in self.tar:
729 with self.tar.extractfile(tarinfo) as fobj:
740 tarinfo = self.tar.next() # get "regtype" (can't use getmember)
741 with self.tar.extractfile(tarinfo) as fobj:
749 tarinfos = self.tar.getmembers()
750 with self.tar.extractfile(tarinfos[0]) as f: # read the first member
756 tar2 = self.tar
793 tar = tarfile.open(name, mode)
797 tar.close()
802 tar = tarfile.open(name, mode, fileobj=f)
806 tar.close()
856 with self.tar.extractfile(tarinfo) as f:
872 tarinfo = self.tar.getmember("ustar/regtype")
876 tarinfo = self.tar.getmember("ustar/conttype")
880 tarinfo = self.tar.getmember("ustar/dirtype")
884 tarinfo = self.tar.getmember("ustar/dirtype-with-size")
888 tarinfo = self.tar.getmember("ustar/lnktype")
892 tarinfo = self.tar.getmember("ustar/symtype")
896 tarinfo = self.tar.getmember("ustar/blktype")
900 tarinfo = self.tar.getmember("ustar/chrtype")
904 tarinfo = self.tar.getmember("ustar/fifotype")
908 tarinfo = self.tar.getmember("ustar/sparse")
912 tarinfo = self.tar.getmember("gnu/sparse")
916 tarinfo = self.tar.getmember("gnu/sparse-0.0")
920 tarinfo = self.tar.getmember("gnu/sparse-0.1")
924 tarinfo = self.tar.getmember("gnu/sparse-1.0")
928 tarinfo = self.tar.getmember("ustar/umlauts-"
934 self.assertIn(name, self.tar.getnames())
937 tarinfo = self.tar.getmember("misc/regtype-old-v7")
941 self.tar.close()
942 self.tar = tarfile.open(self.tarname, mode=self.mode,
944 tarinfo = self.tar.getmember("pax/umlauts-"
955 tarinfo = self.tar.getmember(longname)
965 tarinfo = self.tar.getmember(longlink)
972 tarinfo = self.tar.getmember(longname)
974 self.tar.fileobj.seek(offset)
975 fobj = io.BytesIO(self.tar.fileobj.read(3 * 512))
983 offset = self.tar.getmember(longname).offset
1004 self.tar.extract(name, TEMPDIR)
1056 tar = tarfile.open(tarname, encoding="iso8859-1")
1058 tarinfo = tar.getmember("pax/regtype1")
1064 tarinfo = tar.getmember("pax/regtype2")
1070 tarinfo = tar.getmember("pax/regtype3")
1076 tar.close()
1080 tar = tarfile.open(tarname, encoding="iso8859-1")
1082 tarinfo = tar.getmember("pax/regtype4")
1091 tar.close()
1100 with tarfile.open(fileobj=fobj, mode=self.mode) as tar:
1101 tar.addfile(tarfile.TarInfo("foo"))
1105 del tar
1115 with tarfile.open(tmpname, self.mode) as tar:
1118 tar.addfile(t, io.BytesIO(b"a" * t.size))
1134 tar = tarfile.open(tmpname, self.mode)
1137 tar.addfile(t)
1139 tar.close()
1141 tar = tarfile.open(tmpname)
1143 self.assertEqual(tar.getnames()[0], name,
1146 tar.close()
1150 tar = tarfile.open(tmpname, self.mode)
1155 tar.add(path)
1157 tar.close()
1163 tar = tarfile.open(tmpname, self.mode)
1168 tarinfo = tar.gettarinfo(path)
1173 tarinfo = tar.gettarinfo(path)
1176 tar.close()
1182 tar = tarfile.open(tmpname, self.mode)
1184 tarinfo = tar.gettarinfo(path)
1187 tar.close()
1199 tar = tarfile.open(tmpname, self.mode)
1203 tar.add(path)
1205 for m in tar.getmembers():
1209 tar.close()
1216 with tarfile.open(tmpname, self.mode) as tar:
1220 tarinfo = tar.gettarinfo(path)
1221 tarinfo2 = tar.gettarinfo(os.fspath(path))
1238 tar = tarfile.open(tmpname, self.mode)
1241 tar.gettarinfo(target)
1242 tarinfo = tar.gettarinfo(link)
1245 tar.close()
1255 tar = tarfile.open(tmpname, self.mode)
1257 tarinfo = tar.gettarinfo(path)
1260 tar.close()
1267 tar = tarfile.open(tmpname, self.mode)
1269 self.assertEqual(tar.name, dstname,
1271 tar.add(dstname)
1272 self.assertEqual(tar.getnames(), [],
1276 tar.add(dstname)
1277 self.assertEqual(tar.getnames(), [],
1280 tar.close()
1297 tar = tarfile.open(tmpname, self.mode, encoding="iso8859-1")
1299 tar.add(tempdir, arcname="empty_dir", filter=filter)
1301 tar.close()
1305 tar.add(tempdir, "empty_dir", True, None, filter)
1307 tar = tarfile.open(tmpname, "r")
1309 for tarinfo in tar:
1312 self.assertEqual(len(tar.getmembers()), 3)
1314 tar.close()
1331 tar = tarfile.open(tmpname, self.mode)
1333 tar.add(foo, arcname=path)
1335 tar.close()
1337 tar = tarfile.open(tmpname, "r")
1339 t = tar.next()
1341 tar.close()
1363 with tarfile.open(temparchive, 'w') as tar:
1364 tar.add(source_file, arcname="source")
1365 tar.add(target_file, arcname="symlink")
1367 with tarfile.open(temparchive, errorlevel=2) as tar:
1370 tar.extractall(path=tempdir)
1404 tar = tarfile.open(tmpname, self.mode)
1406 tar.add(".")
1408 tar.close()
1410 tar = tarfile.open(tmpname, "r")
1412 for t in tar:
1416 tar.close()
1429 tar = tarfile.open(tmpname, self.mode, fileobj=f,
1454 tar = tarfile.open(tmpname, self.mode)
1455 tar.close()
1478 tar = tarfile.open(tmpname, self.mode)
1479 tar.close()
1532 tar = tarfile.open(tmpname, "w")
1534 tar.format = tarfile.GNU_FORMAT
1535 tar.addfile(tarinfo)
1538 v2 = tar.offset
1541 tar.close()
1543 tar = tarfile.open(tmpname)
1545 member = tar.next()
1553 tar.close()
1595 tar = tarfile.open(tmpname, self.mode)
1601 tar.addfile(input_blk)
1602 tar.addfile(input_reg)
1604 tar.close()
1607 tar = tarfile.open(tmpname, "r")
1609 output_blk = tar.getmember("my_block_device")
1610 output_reg = tar.getmember("my_regular_file")
1612 tar.close()
1773 self.tar = tarfile.open(tmpname, "w")
1774 self.tar.add(self.foo)
1777 self.tar.close()
1784 tarinfo = self.tar.gettarinfo(self.foo)
1789 tarinfo = self.tar.gettarinfo(self.bar)
1794 self.tar.dereference = True
1795 tarinfo = self.tar.gettarinfo(self.bar)
1809 tar = tarfile.open(tmpname, "w", format=tarfile.PAX_FORMAT)
1811 tar.addfile(tarinfo)
1813 tar.close()
1815 tar = tarfile.open(tmpname)
1818 l = tar.getmembers()[0].linkname
1821 n = tar.getmembers()[0].name
1824 tar.close()
1834 tar = tarfile.open(tmpname, "w", format=tarfile.PAX_FORMAT,
1837 tar.addfile(tarfile.TarInfo("test"))
1839 tar.close()
1842 tar = tarfile.open(tmpname, encoding="iso8859-1")
1844 self.assertEqual(tar.pax_headers, pax_headers)
1845 self.assertEqual(tar.getmembers()[0].pax_headers, pax_headers)
1847 for key, val in tar.pax_headers.items():
1856 tar.close()
1863 tar = tarfile.open(tmpname, "w", format=tarfile.PAX_FORMAT,
1870 tar.addfile(t)
1872 tar.close()
1874 tar = tarfile.open(tmpname, encoding="iso8859-1")
1876 t = tar.getmembers()[0]
1881 tar.close()
1896 tar = tarfile.open(tmpname, "w", format=self.format,
1900 tar.addfile(tarfile.TarInfo(name))
1902 tar.close()
1904 tar = tarfile.open(tmpname, encoding=encoding)
1906 self.assertEqual(tar.getmembers()[0].name, name)
1908 tar.close()
1911 tar = tarfile.open(tmpname, "w", format=self.format,
1917 self.assertRaises(UnicodeError, tar.addfile, tarinfo)
1921 self.assertRaises(UnicodeError, tar.addfile, tarinfo)
1923 tar.close()
1926 tar = tarfile.open(tarname, "r",
1929 for t in tar:
1935 tar.close()
1942 tar = tarfile.open(tmpname, mode="w", format=self.format,
1945 tar.addfile(t)
1947 tar.close()
1949 tar = tarfile.open(tmpname, encoding="iso8859-1")
1951 t = tar.getmember("foo")
1956 tar.close()
1957 tar = tarfile.open(tmpname, encoding="ascii")
1958 t = tar.getmember("foo")
1962 tar.close()
2004 with tarfile.open(tmpname, "w", format=self.format, encoding="utf-8") as tar:
2007 tar.addfile(t)
2009 self.assertRaises(exc, tar.addfile, t)
2012 with tarfile.open(tmpname, "r", encoding="utf-8") as tar:
2013 for t in tar:
2029 with tarfile.open(tmpname, "w", format=self.format, encoding="utf-8") as tar:
2033 tar.addfile(t)
2035 self.assertRaises(exc, tar.addfile, t)
2038 with tarfile.open(tmpname, "r", encoding="utf-8") as tar:
2039 for t in tar:
2055 errors="surrogateescape") as tar:
2057 t = tar.getmember(name)
2075 errors="surrogateescape") as tar:
2077 t = tar.getmember(name)
2095 with tarfile.open(self.tarname, mode) as tar:
2096 tar.addfile(t, f)
2106 with tarfile.open(self.tarname, "a", fileobj=fileobj) as tar:
2107 tar.addfile(tarfile.TarInfo("bar"))
2110 with tarfile.open(self.tarname, fileobj=fileobj) as tar:
2111 self.assertEqual(tar.getnames(), names)
2427 with tarfile.open(tmpname) as tar:
2428 tar.getmembers()
2441 with tarfile.open(tmpname) as tar:
2442 tar.getmembers()
2451 with tarfile.open(dotlessname) as tar:
2452 tar.getmembers()
2462 with tarfile.open(tar_name) as tar:
2463 tar.getmembers()
2477 with filetype.taropen(tar_name) as tar:
2478 tar.getmembers()
2524 with tarfile.open(tarname) as tar:
2525 self.assertFalse(tar.closed, "closed inside runtime context")
2526 self.assertTrue(tar.closed, "context manager failed")
2531 tar = tarfile.open(tarname)
2532 tar.close()
2534 with tar:
2540 with tarfile.open(tarname) as tar:
2544 self.assertTrue(tar.closed, "context manager failed")
2550 with tarfile.open(tmpname, "w") as tar:
2556 self.assertTrue(tar.closed, "context manager failed")
2571 with tarfile.open(fileobj=fobj, mode="w") as tar:
2576 self.assertTrue(tar.closed, "context manager failed")
2586 self.tar.extract(name, TEMPDIR)
2790 with c.open(c.tarname, "wb") as tar:
2791 tar.write(data)