1
0
mirror of https://github.com/mpv-player/mpv synced 2024-12-28 18:12:22 +00:00
mpv/bootstrap.py
wm4 dc87c5e452 bootstrap.py: skip download if waf already exists
It seems like a good idea not to generate any additional network traffic
and wait times if we don't have to.

Also print the URL it's downloading from.

Note that if we require a newer waf release, there will be a problem.
Running ./bootstrap.py won't get the newest waf version anymore in case
the old version is in the source dir. Not sure how to handle this.
2013-11-24 17:00:26 +01:00

35 lines
906 B
Python
Executable File

#!/usr/bin/env python
# This script simply downloads waf to the current directory
from __future__ import print_function
import os, sys, stat, hashlib
if os.path.exists("waf"):
print("Found 'waf', skipping download.")
sys.exit(0)
try:
from urllib.request import urlopen
except:
from urllib2 import urlopen
WAFRELEASE = "waf-1.7.13"
WAFURL = "https://waf.googlecode.com/files/" + WAFRELEASE
SHA256HASH = "03cc750049350ee01cdbc584b70924e333fcc17ba4a2d04648dab1535538a873"
print("Downloading %s..." % WAFURL)
waf = urlopen(WAFURL).read()
if SHA256HASH == hashlib.sha256(waf).hexdigest():
with open("waf", "wb") as wf:
wf.write(waf)
os.chmod("waf", os.stat("waf").st_mode | stat.S_IXUSR)
print("Checksum verified.")
else:
print("The checksum of the downloaded file does not match!")
print("Please download and verify the file manually.")
sys.exit(1)