Skip to content
This repository was archived by the owner on May 23, 2024. It is now read-only.

Commit b1439fd

Browse files
committed
Revert "fixed tar bug :)"
This reverts commit 88e18ff.
1 parent 182b3b6 commit b1439fd

File tree

1 file changed

+1
-39
lines changed

1 file changed

+1
-39
lines changed

bob/utils.py

Lines changed: 1 addition & 39 deletions
Original file line numberDiff line numberDiff line change
@@ -45,46 +45,8 @@ def pipe(a, b, indent=True):
4545

4646
def archive_tree(dir, archive):
4747
"""Creates a tar.gz archive from a given directory."""
48-
49-
abspath = os.path.abspath(dir)
50-
base_root = None
51-
transposed_base = None
52-
is_top_level = False
53-
5448
with tarfile.open(archive, 'w:gz') as tar:
55-
56-
for root, _, files in os.walk(abspath):
57-
58-
# Mark the first pass as the top-level directory.
59-
if is_top_level is None:
60-
is_top_level = True
61-
62-
if not base_root:
63-
base_root = root
64-
65-
# No path at all for the top-level directory.
66-
if not is_top_level:
67-
transposed_base = root[len(base_root)+1:]
68-
else:
69-
transposed_base = ''
70-
71-
72-
for file in files:
73-
74-
standard_path = os.path.join(root, file)
75-
76-
if not transposed_base:
77-
transposed_path = file
78-
else:
79-
transposed_path = os.path.join(transposed_base, file)
80-
81-
# Add the file to the archive, with the proper transposed path.
82-
tar.add(standard_path, arcname=transposed_path)
83-
84-
85-
# Close out the top-level directory marker.
86-
is_top_level = False
87-
49+
tar.add(dir, arcname=os.path.basename(dir))
8850

8951
def extract_tree(archive, dir):
9052
"""Extract tar.gz archive to a given directory."""

0 commit comments

Comments
 (0)