diff options
author | Lars Wirzenius <lars.wirzenius@codethink.co.uk> | 2012-04-17 18:44:00 +0100 |
---|---|---|
committer | Lars Wirzenius <lars.wirzenius@codethink.co.uk> | 2012-04-18 18:29:25 +0100 |
commit | a04f2f05b6aaa0d99420ad45c35a56be93445566 (patch) | |
tree | ec38d82cc5ed3adf60c986876880d8ddf6ad9c53 | |
parent | 5b951ecb84546f3cfbe38eb559179a5fbc88395e (diff) | |
download | morph-a04f2f05b6aaa0d99420ad45c35a56be93445566.tar.gz |
Add a way to unpack a tar file from an open file handle
-rw-r--r-- | morphlib/bins.py | 12 |
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. |