mirror of https://github.com/mpv-player/mpv
bootstrap: add waf mirror
This commit is contained in:
parent
9cd523bf5f
commit
958dbca3ef
23
bootstrap.py
23
bootstrap.py
|
@ -6,7 +6,8 @@ from __future__ import print_function
|
||||||
import os, sys, stat, hashlib, subprocess
|
import os, sys, stat, hashlib, subprocess
|
||||||
|
|
||||||
WAFRELEASE = "waf-1.8.4"
|
WAFRELEASE = "waf-1.8.4"
|
||||||
WAFURL = "http://ftp.waf.io/pub/release/" + WAFRELEASE
|
WAFURLS = ["http://ftp.waf.io/pub/release/" + WAFRELEASE,
|
||||||
|
"http://www.freehackers.org/~tnagy/release/" + WAFRELEASE]
|
||||||
SHA256HASH = "f02035fa5d8814f33f19b2b20d43822ddef6bb39b955ca196c2a247a1f9ffaa8"
|
SHA256HASH = "f02035fa5d8814f33f19b2b20d43822ddef6bb39b955ca196c2a247a1f9ffaa8"
|
||||||
|
|
||||||
if os.path.exists("waf"):
|
if os.path.exists("waf"):
|
||||||
|
@ -16,12 +17,24 @@ if os.path.exists("waf"):
|
||||||
sys.exit(0)
|
sys.exit(0)
|
||||||
|
|
||||||
try:
|
try:
|
||||||
from urllib.request import urlopen
|
from urllib.request import urlopen, URLError
|
||||||
except:
|
except:
|
||||||
from urllib2 import urlopen
|
from urllib2 import urlopen, URLError
|
||||||
|
|
||||||
print("Downloading %s..." % WAFURL)
|
waf = None
|
||||||
waf = urlopen(WAFURL).read()
|
|
||||||
|
for WAFURL in WAFURLS:
|
||||||
|
try:
|
||||||
|
print("Downloading {}...".format(WAFURL))
|
||||||
|
waf = urlopen(WAFURL).read()
|
||||||
|
break
|
||||||
|
except URLError:
|
||||||
|
print("Download failed.")
|
||||||
|
|
||||||
|
if not waf:
|
||||||
|
print("Could not download {}.".format(WAFRELEASE))
|
||||||
|
|
||||||
|
sys.exit(1)
|
||||||
|
|
||||||
if SHA256HASH == hashlib.sha256(waf).hexdigest():
|
if SHA256HASH == hashlib.sha256(waf).hexdigest():
|
||||||
with open("waf", "wb") as wf:
|
with open("waf", "wb") as wf:
|
||||||
|
|
Loading…
Reference in New Issue