aboutsummaryrefslogtreecommitdiffstats
path: root/python/build/tar.py
diff options
context:
space:
mode:
authorMax Kellermann <max@duempel.org>2015-11-20 22:10:22 +0100
committerMax Kellermann <max@duempel.org>2015-11-20 22:14:53 +0100
commit556f9ee39cf1e675b961614f61e784f996af1e98 (patch)
tree01c6e79e4907539cdb2a674dac329e266b2a6729 /python/build/tar.py
parent7dad662d690cc1c374009bbcd0df03bccb8f9ad7 (diff)
downloadmpd-556f9ee39cf1e675b961614f61e784f996af1e98.tar.gz
mpd-556f9ee39cf1e675b961614f61e784f996af1e98.tar.xz
mpd-556f9ee39cf1e675b961614f61e784f996af1e98.zip
{android,win32}/build.py: move common code to python/build/
Diffstat (limited to '')
-rw-r--r--python/build/tar.py11
1 files changed, 11 insertions, 0 deletions
diff --git a/python/build/tar.py b/python/build/tar.py
new file mode 100644
index 000000000..15bbfca6b
--- /dev/null
+++ b/python/build/tar.py
@@ -0,0 +1,11 @@
+import os, shutil, subprocess
+
+def untar(tarball_path, parent_path, base):
+ path = os.path.join(parent_path, base)
+ try:
+ shutil.rmtree(path)
+ except FileNotFoundError:
+ pass
+ os.makedirs(parent_path, exist_ok=True)
+ subprocess.check_call(['/bin/tar', 'xfC', tarball_path, parent_path])
+ return path