mirror of
https://github.com/servo/servo.git
synced 2025-07-26 16:50:23 +01:00
Add ./mach bootstrap-android
This commit is contained in:
parent
c71c55e542
commit
b9d5f11b20
3 changed files with 66 additions and 1 deletions
|
@ -9,6 +9,7 @@
|
|||
|
||||
from __future__ import absolute_import, print_function, unicode_literals
|
||||
|
||||
import hashlib
|
||||
import os
|
||||
import os.path
|
||||
import platform
|
||||
|
@ -165,3 +166,15 @@ def extract(src, dst, movedir=None):
|
|||
os.rmdir(movedir)
|
||||
|
||||
os.remove(src)
|
||||
|
||||
def check_hash(filename, expected, algorithm):
|
||||
hasher = hashlib.new(algorithm)
|
||||
with open(filename, "rb") as f:
|
||||
while True:
|
||||
block = f.read(16 * 1024)
|
||||
if len(block) == 0:
|
||||
break
|
||||
hasher.update(block)
|
||||
if hasher.hexdigest() != expected:
|
||||
print("Incorrect {} hash for {}".format(algorithm, filename))
|
||||
sys.exit(1)
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue