Something went wrong. Try again.
🎥 Command line media player
Something went wrong. Try again.
12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152#!/usr/bin/env python
# This script simply downloads waf to the current directory
from __future__ import print_functionimport os, sys, stat, hashlib, subprocess
WAFRELEASE = "waf-1.9.8"WAFURLS = ["https://waf.io/" + WAFRELEASE, "http://www.freehackers.org/~tnagy/release/" + WAFRELEASE]SHA256HASH = "167dc42bab6d5bd823b798af195420319cb5c9b571e00db7d83df2a0fe1f4dbf"
if os.path.exists("waf"): wafver = subprocess.check_output([sys.executable, './waf', '--version']).decode() if WAFRELEASE.split('-')[1] == wafver.split(' ')[1]: print("Found 'waf', skipping download.") sys.exit(0)
try: from urllib.request import urlopen, URLErrorexcept: from urllib2 import urlopen, URLError
waf = None
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(): 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)