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

Commit fe3e9bf

Browse files
author
Kenneth Reitz
committed
extract_tree
1 parent 3310ab8 commit fe3e9bf

File tree

2 files changed

+9
-3
lines changed

2 files changed

+9
-3
lines changed

bob/models.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -85,10 +85,11 @@ def resolve_deps(self):
8585
print
8686

8787
if deps:
88-
print 'Resolving dependencies... found {}:'.format(len(deps))
88+
print 'Fetching dependencies... found {}:'.format(len(deps))
8989

9090
for dep in deps:
9191
print ' - {}'.format(dep)
92+
9293
# Grab the Dep from S3, download it to a temp file.
9394
# Extract the Dep to the appropriate location.
9495
# If it doesn't exist, bail.

bob/utils.py

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -43,7 +43,12 @@ def pipe(a, b, indent=True):
4343
b.write(line)
4444

4545

46-
def targz_tree(dir, output):
46+
def archive_tree(dir, archive):
4747
"""Creates a tar.gz archive from a given directory."""
48-
with tarfile.open(output, 'w:gz') as tar:
48+
with tarfile.open(archive, 'w:gz') as tar:
4949
tar.add(dir, arcname=os.path.basename(dir))
50+
51+
def extract_tree(archive, dir):
52+
"""Extract tar.gz archive to a given directory."""
53+
with tarfile.open(archive, 'r:gz') as tar:
54+
tar.extractall(dir)

0 commit comments

Comments
 (0)