pflask/bootstrap.py
Alessandro Ghedini 52767614a4 Revert "build: change waf URL to ftp://"
This reverts commit 30ed8d1c79.

Looks like the http:// URL works again (and ftp:// doesn't).
2015-03-25 00:01:19 +01:00

38 lines
1.1 KiB
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, subprocess
WAFRELEASE = "waf-1.8.6"
WAFURL = "http://ftp.waf.io/pub/release/" + WAFRELEASE
SHA256HASH = "81c4e6a3144c7b2021a839e7277bdaf1cedbbc87302186897b4ae03f4effcbf5"
if os.path.exists("waf"):
wafver = subprocess.check_output(['./waf', '--version']).decode()
if WAFRELEASE.split('-')[1] == wafver.split(' ')[1]:
print("Found 'waf', skipping download.")
sys.exit(0)
try:
from urllib.request import urlopen
except:
from urllib2 import urlopen
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(" - got: {}".format(hashlib.sha256(waf).hexdigest()))
print(" - expected: {}".format(SHA256HASH))
print("Please download and verify the file manually.")
sys.exit(1)