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

Commit 1c2079d

Browse files
committed
Merge pull request #12 from dzuelke/tarball
Fix tarball creation, for real :)
2 parents c1a92d4 + 06b3e19 commit 1c2079d

File tree

2 files changed

+4
-33
lines changed

2 files changed

+4
-33
lines changed

bob/utils.py

+3-32
Original file line numberDiff line numberDiff line change
@@ -45,39 +45,10 @@ 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-
is_top_level = False
52-
5348
with tarfile.open(archive, 'w:gz') as tar:
54-
55-
for root, _, files in os.walk(abspath):
56-
57-
# Mark the first pass as the top-level directory.
58-
if is_top_level is None:
59-
is_top_level = True
60-
61-
if not base_root:
62-
base_root = root
63-
64-
transposed_base = root[len(base_root)+1:]
65-
66-
for file in files:
67-
68-
standard_path = os.path.join(root, file)
69-
70-
if is_top_level:
71-
transposed_path = file
72-
else:
73-
transposed_path = os.path.join(transposed_base, file)
74-
75-
# Add the file to the archive, with the proper transposed path.
76-
tar.add(standard_path, arcname=transposed_path)
77-
78-
# Close out the top-level directory marker.
79-
is_top_level = False
80-
49+
# do not tar.add(dir) with empty arcname, that will create a "/" entry and tar will complain when extracting
50+
for item in os.listdir(dir):
51+
tar.add(dir+"/"+item, arcname=item)
8152

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

setup.py

100644100755
+1-1
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@
1515

1616
setup(
1717
name='bob-builder',
18-
version='0.0.5',
18+
version='0.0.6',
1919
install_requires=deps,
2020
description='Binary Build Toolkit.',
2121
# long_description='Meh.',/

0 commit comments

Comments
 (0)