From 2830548768ad89b4d23e9504cb8e0e16b1d5d681 Mon Sep 17 00:00:00 2001 From: Fangrui Song Date: Tue, 2 Jan 2018 20:33:53 -0800 Subject: [PATCH] [waf] Prep for travis cache directories --- wscript | 37 +++++++++++++++++++------------------ 1 file changed, 19 insertions(+), 18 deletions(-) diff --git a/wscript b/wscript index c9b1a5e7..5ef6bf7e 100644 --- a/wscript +++ b/wscript @@ -91,27 +91,28 @@ def options(opt): def download_and_extract(destdir, url, ext): dest = destdir + ext - # Download and save the compressed tarball as |compressed_file_name|. - if not os.path.isfile(dest): - print('Downloading tarball') - print(' destination: {0}'.format(dest)) - print(' source: {0}'.format(url)) - # TODO: verify checksum - for _ in range(5): - try: - response = urlopen(url, timeout=60) - break - except URLError: - print('Retry') - continue - with open(dest, 'wb') as f: - f.write(response.read()) - else: - print('Found tarball at {0}'.format(dest)) # Extract the tarball. if not os.path.isdir(destdir): - print('Extracting') + # Download and save the compressed tarball as |compressed_file_name|. + if not os.path.isfile(dest): + print('Downloading tarball') + print(' destination: {0}'.format(dest)) + print(' source: {0}'.format(url)) + # TODO: verify checksum + for _ in range(5): + try: + response = urlopen(url, timeout=60) + break + except URLError: + print('Retry') + continue + with open(dest, 'wb') as f: + f.write(response.read()) + else: + print('Found tarball at {0}'.format(dest)) + + print('Extracting {0}'.format(dest)) # TODO: make portable. if ext == '.exe': subprocess.call(['7z', 'x', '-o{0}'.format(destdir), '-xr!$PLUGINSDIR', dest])