summaryrefslogtreecommitdiff
path: root/python/build
diff options
context:
space:
mode:
authorShen-Ta Hsieh <ibmibmibm.tw@gmail.com>2020-06-03 21:35:07 +0800
committerShen-Ta Hsieh <ibmibmibm.tw@gmail.com>2020-06-05 11:22:52 +0800
commit9a4059ba395a3ad868e86d9f9eeafa8e2b9f42ef (patch)
treee196db90b80674607248fa81a0ceb955694b5d39 /python/build
parent759f4231d257122cf9dba858ca04de5f835c0859 (diff)
misc: use python builtin tar library when /bin/tar not found
Diffstat (limited to 'python/build')
-rw-r--r--python/build/tar.py8
1 files changed, 7 insertions, 1 deletions
diff --git a/python/build/tar.py b/python/build/tar.py
index 15bbfca6b..7cb7db67c 100644
--- a/python/build/tar.py
+++ b/python/build/tar.py
@@ -7,5 +7,11 @@ def untar(tarball_path, parent_path, base):
except FileNotFoundError:
pass
os.makedirs(parent_path, exist_ok=True)
- subprocess.check_call(['/bin/tar', 'xfC', tarball_path, parent_path])
+ try:
+ subprocess.check_call(['/bin/tar', 'xfC', tarball_path, parent_path])
+ except FileNotFoundError:
+ import tarfile
+ tar = tarfile.open(tarball_path)
+ tar.extractall(path=parent_path)
+ tar.close()
return path