summaryrefslogtreecommitdiff
path: root/morphlib/bins.py
diff options
context:
space:
mode:
authorLars Wirzenius <lars.wirzenius@codethink.co.uk>2012-04-17 18:44:00 +0100
committerLars Wirzenius <lars.wirzenius@codethink.co.uk>2012-04-18 18:29:25 +0100
commita04f2f05b6aaa0d99420ad45c35a56be93445566 (patch)
treeec38d82cc5ed3adf60c986876880d8ddf6ad9c53 /morphlib/bins.py
parent5b951ecb84546f3cfbe38eb559179a5fbc88395e (diff)
downloadmorph-a04f2f05b6aaa0d99420ad45c35a56be93445566.tar.gz
Add a way to unpack a tar file from an open file handle
Diffstat (limited to 'morphlib/bins.py')
-rw-r--r--morphlib/bins.py12
1 files changed, 12 insertions, 0 deletions
diff --git a/morphlib/bins.py b/morphlib/bins.py
index fd0f28d4..05a18b97 100644
--- a/morphlib/bins.py
+++ b/morphlib/bins.py
@@ -101,6 +101,18 @@ def create_stratum(rootdir, f, ex):
tar.close()
+def unpack_binary_from_file(f, dirname, ex): # pragma: no cover
+ '''Unpack a binary into a directory.
+
+ The directory must exist already.
+
+ '''
+
+ tf = tarfile.open(fileobj=f)
+ tf.extractall(path=dirname)
+ tf.close()
+
+
def unpack_binary(filename, dirname, ex):
'''Unpack a binary into a directory.