tarfile: Rename from utarfile.

This is compatible with the CPython module, so should
be named tarfile.

Signed-off-by: Jim Mussared <jim.mussared@gmail.com>
pull/702/head
Jim Mussared 2023-07-21 16:21:11 +10:00 zatwierdzone przez Damien George
rodzic e45a7f6c18
commit 5004436164
8 zmienionych plików z 15 dodań i 15 usunięć

Wyświetl plik

@ -1,4 +0,0 @@
metadata(description="Adds write (create/append) support to utarfile.", version="0.1.1")
require("utarfile")
package("utarfile")

Wyświetl plik

@ -1,7 +1,7 @@
""" tar append writes additional files to the end of an existing tar file."""
import os
import sys
import utarfile
import tarfile
if len(sys.argv) < 2:
raise ValueError("Usage: %s appendfile.tar newinputfile1 ..." % sys.argv[0])
@ -10,6 +10,6 @@ tarfile = sys.argv[1]
if not tarfile.endswith(".tar"):
raise ValueError("Filename %s does not end with .tar" % tarfile)
with utarfile.TarFile(sys.argv[1], "a") as t:
with tarfile.TarFile(sys.argv[1], "a") as t:
for filename in sys.argv[2:]:
t.add(filename)

Wyświetl plik

@ -1,6 +1,6 @@
""" tar create writes a new tar file containing the specified files."""
import sys
import utarfile
import tarfile
if len(sys.argv) < 2:
raise ValueError("Usage: %s outputfile.tar inputfile1 ..." % sys.argv[0])
@ -9,6 +9,6 @@ tarfile = sys.argv[1]
if not tarfile.endswith(".tar"):
raise ValueError("Filename %s does not end with .tar" % tarfile)
with utarfile.TarFile(sys.argv[1], "w") as t:
with tarfile.TarFile(sys.argv[1], "w") as t:
for filename in sys.argv[2:]:
t.add(filename)

Wyświetl plik

@ -0,0 +1,4 @@
metadata(description="Adds write (create/append) support to tarfile.", version="0.1.1")
require("tarfile")
package("tarfile")

Wyświetl plik

@ -1,7 +1,7 @@
"""Additions to the TarFile class to support creating and appending tar files.
The methods defined below in are injected into the TarFile class in the
utarfile package.
tarfile package.
"""
import uctypes

Wyświetl plik

@ -1,14 +1,14 @@
import sys
import os
import utarfile
import tarfile
if len(sys.argv) < 2:
raise ValueError("Usage: %s inputfile.tar" % sys.argv[0])
t = utarfile.TarFile(sys.argv[1])
t = tarfile.TarFile(sys.argv[1])
for i in t:
print(i.name)
if i.type == utarfile.DIRTYPE:
if i.type == tarfile.DIRTYPE:
os.mkdir(i.name)
else:
f = t.extractfile(i)

Wyświetl plik

@ -2,4 +2,4 @@ metadata(description="Read-only implementation of Python's tarfile.", version="0
# Originally written by Paul Sokolovsky.
package("utarfile")
package("tarfile")

Wyświetl plik

@ -93,7 +93,7 @@ class TarFile:
try:
self._open_write(name=name, mode=mode, fileobj=fileobj)
except AttributeError:
raise NotImplementedError("Install utarfile-write")
raise NotImplementedError("Install tarfile-write")
def __enter__(self):
return self
@ -141,7 +141,7 @@ class TarFile:
pass
self.f.close()
# Add additional methods to support write/append from the utarfile-write package.
# Add additional methods to support write/append from the tarfile-write package.
try:
from .write import _open_write, _close_write, addfile, add
except ImportError: