aboutsummaryrefslogtreecommitdiffstats
path: root/python/servo/util.py
diff options
context:
space:
mode:
authorSimon Sapin <simon.sapin@exyr.org>2018-06-25 23:25:22 +0200
committerSimon Sapin <simon.sapin@exyr.org>2018-07-02 13:25:44 +0200
commit484eee86248e7eab71fe78dab2c1419a42e61271 (patch)
treea4cf3c06ad2f575b70b4163b37a11e4c715b8f52 /python/servo/util.py
parent6e6870516e38ce7d9be785ef7e3d7711e6d1b55b (diff)
downloadservo-484eee86248e7eab71fe78dab2c1419a42e61271.tar.gz
servo-484eee86248e7eab71fe78dab2c1419a42e61271.zip
Tidy
Diffstat (limited to 'python/servo/util.py')
-rw-r--r--python/servo/util.py3
1 files changed, 3 insertions, 0 deletions
diff --git a/python/servo/util.py b/python/servo/util.py
index 7c4cc5aee1b..d71cffe27da 100644
--- a/python/servo/util.py
+++ b/python/servo/util.py
@@ -153,6 +153,7 @@ def download_file(desc, src, dst):
download(desc, src, fd)
os.rename(tmp_path, dst)
+
# https://stackoverflow.com/questions/39296101/python-zipfile-removes-execute-permissions-from-binaries
# In particular, we want the executable bit for executable files.
class ZipFileWithUnixPermissions(zipfile.ZipFile):
@@ -169,6 +170,7 @@ class ZipFileWithUnixPermissions(zipfile.ZipFile):
os.chmod(extracted, mode)
return extracted
+
def extract(src, dst, movedir=None, remove=True):
assert src.endswith(".zip")
ZipFileWithUnixPermissions(src).extractall(dst)
@@ -183,6 +185,7 @@ def extract(src, dst, movedir=None, remove=True):
if remove:
os.remove(src)
+
def check_hash(filename, expected, algorithm):
hasher = hashlib.new(algorithm)
with open(filename, "rb") as f: