aboutsummaryrefslogtreecommitdiffstats
path: root/python/build/tar.py
diff options
context:
space:
mode:
Diffstat (limited to 'python/build/tar.py')
-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