Skip to content

Commit c8edfa2

Browse files
authored
Merge pull request #138 from pytest-dev/appveyor-cache
Cache PyQt installers in AppVeyor
2 parents 97e6f0d + cde8dd1 commit c8edfa2

File tree

2 files changed

+16
-4
lines changed

2 files changed

+16
-4
lines changed

appveyor.yml

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,9 @@ install:
1818
- C:\Python27\python -u scripts\install-qt.py
1919
- C:\Python27\python -m pip install tox
2020

21+
cache:
22+
- C:\Installers -> appveyor.yml, scripts\install-qt.py
23+
2124
build: false # Not a C# project
2225

2326
test_script:

scripts/install-qt.py

Lines changed: 13 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -36,15 +36,24 @@ def fix_registry(python_ver):
3636
fix_registry('35')
3737
fix_registry('27')
3838
caption = os.environ['INSTALL_QT']
39-
url = downloads[caption]
40-
print("Downloading %s..." % caption)
41-
installer = r'C:\install-%s.exe' % caption
42-
urllib.urlretrieve(base_url + url, installer)
39+
installers_dir = r'C:\Installers'
40+
if not os.path.isdir(installers_dir):
41+
os.makedirs(installers_dir)
42+
installer = os.path.join(installers_dir, 'install-%s.exe' % caption)
43+
if not os.path.isfile(installer):
44+
# download all files because the cache is for all builds
45+
for cap, url in sorted(downloads.items()):
46+
print("Downloading %s..." % cap)
47+
filename = os.path.join(installers_dir, 'install-%s.exe' % cap)
48+
urllib.urlretrieve(base_url + url, filename)
49+
else:
50+
print('Using cached installers')
4351
print('Installing %s...' % caption)
4452
subprocess.check_call([installer, '/S'])
4553
python = caption.split('-')[0]
4654
assert python[:2] == 'py'
4755
executable = r'C:\Python%s\python.exe' % python[2:]
56+
url = downloads[caption]
4857
module = url.split('/')[0]
4958
cmdline = [executable, '-c', 'import %s;print(%s)' % (module, module)]
5059
print('Checking: %r' % cmdline)

0 commit comments

Comments
 (0)