summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAndoni Morales Alastruey <ylatuya@gmail.com>2020-11-25 16:23:46 +0000
committerTim-Philipp Müller <tim@centricular.com>2021-01-13 01:06:38 +0000
commitc805ec285277f9003da6da0ec7bfb981e5a3a2f1 (patch)
treead760a2c2dca05a51e3250ddce11afb4feced50e
parent26c2fe7298ad08519aadd60f5668819d86029c6a (diff)
Add support to extract .dmg volumes
Part-of: <https://gitlab.freedesktop.org/gstreamer/cerbero/-/merge_requests/661>
-rw-r--r--cerbero/utils/shell.py7
1 files changed, 7 insertions, 0 deletions
diff --git a/cerbero/utils/shell.py b/cerbero/utils/shell.py
index a8a8896b..fda95832 100644
--- a/cerbero/utils/shell.py
+++ b/cerbero/utils/shell.py
@@ -332,6 +332,13 @@ async def unpack(filepath, output_dir, logfile=None):
elif filepath.endswith('.zip'):
zf = zipfile.ZipFile(filepath, "r")
zf.extractall(path=output_dir)
+ elif filepath.endswith('.dmg'):
+ vol_name = '/Volumes/' + os.path.splitext(os.path.split(filepath)[1])[0]
+ if not os.path.exists(output_dir):
+ os.makedirs(output_dir)
+ call(['hdiutil', 'attach', filepath])
+ call(['cp', '-r', vol_name, output_dir])
+ call(['hdiutil', 'detach', vol_name])
else:
raise FatalError("Unknown tarball format %s" % filepath)