From cde8dd16693847570c87bcc95e8a5e5b1d11f930 Mon Sep 17 00:00:00 2001 From: Bruno Oliveira Date: Wed, 29 Jun 2016 13:25:45 -0300 Subject: [PATCH] Cache PyQt installers in AppVeyor --- appveyor.yml | 3 +++ scripts/install-qt.py | 17 +++++++++++++---- 2 files changed, 16 insertions(+), 4 deletions(-) diff --git a/appveyor.yml b/appveyor.yml index 0904ec00..fddf248f 100644 --- a/appveyor.yml +++ b/appveyor.yml @@ -18,6 +18,9 @@ install: - C:\Python27\python -u scripts\install-qt.py - C:\Python27\python -m pip install tox +cache: + - C:\Installers -> appveyor.yml, scripts\install-qt.py + build: false # Not a C# project test_script: diff --git a/scripts/install-qt.py b/scripts/install-qt.py index 9744811c..ba3a877d 100644 --- a/scripts/install-qt.py +++ b/scripts/install-qt.py @@ -36,15 +36,24 @@ def fix_registry(python_ver): fix_registry('35') fix_registry('27') caption = os.environ['INSTALL_QT'] - url = downloads[caption] - print("Downloading %s..." % caption) - installer = r'C:\install-%s.exe' % caption - urllib.urlretrieve(base_url + url, installer) + installers_dir = r'C:\Installers' + if not os.path.isdir(installers_dir): + os.makedirs(installers_dir) + installer = os.path.join(installers_dir, 'install-%s.exe' % caption) + if not os.path.isfile(installer): + # download all files because the cache is for all builds + for cap, url in sorted(downloads.items()): + print("Downloading %s..." % cap) + filename = os.path.join(installers_dir, 'install-%s.exe' % cap) + urllib.urlretrieve(base_url + url, filename) + else: + print('Using cached installers') print('Installing %s...' % caption) subprocess.check_call([installer, '/S']) python = caption.split('-')[0] assert python[:2] == 'py' executable = r'C:\Python%s\python.exe' % python[2:] + url = downloads[caption] module = url.split('/')[0] cmdline = [executable, '-c', 'import %s;print(%s)' % (module, module)] print('Checking: %r' % cmdline)