Skip to content

Commit 5004436

Browse files
jimmodpgeorge
authored andcommitted
tarfile: Rename from utarfile.
This is compatible with the CPython module, so should be named tarfile. Signed-off-by: Jim Mussared <[email protected]>
1 parent e45a7f6 commit 5004436

File tree

8 files changed

+15
-15
lines changed

8 files changed

+15
-15
lines changed

micropython/utarfile-write/manifest.py

Lines changed: 0 additions & 4 deletions
This file was deleted.
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
""" tar append writes additional files to the end of an existing tar file."""
22
import os
33
import sys
4-
import utarfile
4+
import tarfile
55

66
if len(sys.argv) < 2:
77
raise ValueError("Usage: %s appendfile.tar newinputfile1 ..." % sys.argv[0])
@@ -10,6 +10,6 @@
1010
if not tarfile.endswith(".tar"):
1111
raise ValueError("Filename %s does not end with .tar" % tarfile)
1212

13-
with utarfile.TarFile(sys.argv[1], "a") as t:
13+
with tarfile.TarFile(sys.argv[1], "a") as t:
1414
for filename in sys.argv[2:]:
1515
t.add(filename)
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
""" tar create writes a new tar file containing the specified files."""
22
import sys
3-
import utarfile
3+
import tarfile
44

55
if len(sys.argv) < 2:
66
raise ValueError("Usage: %s outputfile.tar inputfile1 ..." % sys.argv[0])
@@ -9,6 +9,6 @@
99
if not tarfile.endswith(".tar"):
1010
raise ValueError("Filename %s does not end with .tar" % tarfile)
1111

12-
with utarfile.TarFile(sys.argv[1], "w") as t:
12+
with tarfile.TarFile(sys.argv[1], "w") as t:
1313
for filename in sys.argv[2:]:
1414
t.add(filename)
Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
metadata(description="Adds write (create/append) support to tarfile.", version="0.1.1")
2+
3+
require("tarfile")
4+
package("tarfile")

micropython/utarfile-write/utarfile/write.py renamed to python-stdlib/tarfile-write/tarfile/write.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
"""Additions to the TarFile class to support creating and appending tar files.
22
33
The methods defined below in are injected into the TarFile class in the
4-
utarfile package.
4+
tarfile package.
55
"""
66

77
import uctypes

micropython/utarfile/example-extract.py renamed to python-stdlib/tarfile/example-extract.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,14 @@
11
import sys
22
import os
3-
import utarfile
3+
import tarfile
44

55
if len(sys.argv) < 2:
66
raise ValueError("Usage: %s inputfile.tar" % sys.argv[0])
77

8-
t = utarfile.TarFile(sys.argv[1])
8+
t = tarfile.TarFile(sys.argv[1])
99
for i in t:
1010
print(i.name)
11-
if i.type == utarfile.DIRTYPE:
11+
if i.type == tarfile.DIRTYPE:
1212
os.mkdir(i.name)
1313
else:
1414
f = t.extractfile(i)

micropython/utarfile/manifest.py renamed to python-stdlib/tarfile/manifest.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,4 +2,4 @@
22

33
# Originally written by Paul Sokolovsky.
44

5-
package("utarfile")
5+
package("tarfile")

micropython/utarfile/utarfile/__init__.py renamed to python-stdlib/tarfile/tarfile/__init__.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -93,7 +93,7 @@ def __init__(self, name=None, mode="r", fileobj=None):
9393
try:
9494
self._open_write(name=name, mode=mode, fileobj=fileobj)
9595
except AttributeError:
96-
raise NotImplementedError("Install utarfile-write")
96+
raise NotImplementedError("Install tarfile-write")
9797

9898
def __enter__(self):
9999
return self
@@ -141,7 +141,7 @@ def close(self):
141141
pass
142142
self.f.close()
143143

144-
# Add additional methods to support write/append from the utarfile-write package.
144+
# Add additional methods to support write/append from the tarfile-write package.
145145
try:
146146
from .write import _open_write, _close_write, addfile, add
147147
except ImportError:

0 commit comments

Comments
 (0)