diff --git a/.travis.yml b/.travis.yml index cee1b5d8..8d4205bb 100644 --- a/.travis.yml +++ b/.travis.yml @@ -3,14 +3,19 @@ sudo: required dist: trusty env: - - PYTEST_QT_API=pyqt4 PYTHON=python2.7 - - PYTEST_QT_API=pyqt4v2 PYTHON=python2.7 - - PYTEST_QT_API=pyside PYTHON=python2.7 + global: + # used by ci-helpers + - CONDA_CHANNELS=conda-forge SETUP_XVFB=true DEPS="pytest tox coveralls" - - PYTEST_QT_API=pyqt4 PYTHON=python3.4 - - PYTEST_QT_API=pyqt4v2 PYTHON=python3.4 - - PYTEST_QT_API=pyside PYTHON=python3.4 - - PYTEST_QT_API=pyqt5 PYTHON=python3.4 + matrix: + - PYTEST_QT_API=pyqt4 PYQT_PACKAGE="pyqt=4.*" PYTHON_VERSION=2.7 + - PYTEST_QT_API=pyqt4v2 PYQT_PACKAGE="pyqt=4.*" PYTHON_VERSION=2.7 + - PYTEST_QT_API=pyside PYQT_PACKAGE="pyside=1.*" PYTHON_VERSION=2.7 + + - PYTEST_QT_API=pyqt4 PYQT_PACKAGE="pyqt=4.*" PYTHON_VERSION=3.4 + - PYTEST_QT_API=pyqt4v2 PYQT_PACKAGE="pyqt=4.*" PYTHON_VERSION=3.4 + - PYTEST_QT_API=pyside PYQT_PACKAGE="pyside=1.*" PYTHON_VERSION=3.4 + - PYTEST_QT_API=pyqt5 PYQT_PACKAGE="pyqt=5.*" PYTHON_VERSION=3.4 install: - sudo apt-get update @@ -18,30 +23,22 @@ install: # Xvfb / window manager - sudo apt-get install -y xvfb herbstluftwm - # Qt - - $PYTHON scripts/install-qt.py - - # Pip (3.4 does not have it by default) - - wget https://bootstrap.pypa.io/get-pip.py - - sudo $PYTHON get-pip.py - - # Dependencies - - sudo $PYTHON -m pip install -U pytest tox coveralls + # Setup miniconda + - git clone --depth 1 git://github.com/astropy/ci-helpers.git + - CONDA_DEPENDENCIES="${DEPS} ${PYQT_PACKAGE}" source ci-helpers/travis/setup_conda.sh + - source activate test && pip install -e . - # pytest-qt - - sudo $PYTHON setup.py develop before_script: - - "export DISPLAY=:99.0" - - start-stop-daemon --start --background --exec /usr/bin/Xvfb -- $DISPLAY -screen 0 1024x768x24 - - sleep 3 # give xvfb some time to start - "herbstluftwm &" - sleep 1 script: - - catchsegv coverage run --source=pytestqt -m pytest tests - - sudo tox -e lint - - sudo chmod -R a+rw . + - source activate test && catchsegv coverage run --source=pytestqt -m pytest tests + # for some reason tox doesn't get installed with a u+x flag + - | + chmod u+x /home/travis/miniconda/envs/test/bin/tox + /home/travis/miniconda/envs/test/bin/tox -e lint after_success: - coveralls diff --git a/README.rst b/README.rst index 1185a523..39d12698 100644 --- a/README.rst +++ b/README.rst @@ -155,6 +155,7 @@ Many thanks to: - Florian Bruhin (`@The-Compiler `_); - Guilherme Quentel Melo (`@gqmelo `_); - Francesco Montesano (`@montefra `_); +- Roman Yurchak (`@rth `_) **Powered by** diff --git a/appveyor.yml b/appveyor.yml index 400ae94c..44a69469 100644 --- a/appveyor.yml +++ b/appveyor.yml @@ -1,27 +1,60 @@ -environment: - matrix: - - INSTALL_QT: "py34-pyqt5" - TESTENVS: "py34-pyqt5" - - - INSTALL_QT: "py35-pyqt5" - TESTENVS: "py35-pyqt5" - - - INSTALL_QT: "py34-pyqt4" - TESTENVS: "py34-pyqt4" +# Adapted from the qtpy Appveyor setup - - INSTALL_QT: "py27-pyqt4" - TESTENVS: "py27-pyqt4" +environment: + global: + PYTHON: "C:\\conda" + CMD_IN_ENV: "cmd /E:ON /V:ON /C .\\ci-helpers\\appveyor\\windows_sdk.cmd" + PYTHON_ARCH: "64" # needs to be set for CMD_IN_ENV to succeed. If a mix + # of 32 bit and 64 bit builds are needed, move this + # to the matrix section. + # Used by atropy ci-helpers + CONDA_CHANNELS: "conda-forge" - - TESTENVS: "py27-pyside,py34-pyside,lint" + matrix: + - PYTHON_VERSION: "2.7" + PYTEST_QT_API: "pyqt4" + CONDA_DEPENDENCIES: "pytest pyqt=4.*" + - PYTHON_VERSION: "2.7" + PYTEST_QT_API: "pyqt4v2" + CONDA_DEPENDENCIES: "pytest pyqt=4.*" + - PYTHON_VERSION: "2.7" + PYTEST_QT_API: "pyside" + CONDA_DEPENDENCIES: "pytest pyside=1.*" + + - PYTHON_VERSION: "3.4" + PYTEST_QT_API: "pyqt4" + CONDA_DEPENDENCIES: "pytest pyqt=4.*" + - PYTHON_VERSION: "3.4" + PYTEST_QT_API: "pyqt4v2" + CONDA_DEPENDENCIES: "pytest pyqt=4.*" + - PYTHON_VERSION: "3.4" + PYTEST_QT_API: "pyside" + CONDA_DEPENDENCIES: "pytest pyside=1.*" + - PYTHON_VERSION: "3.4" + PYTEST_QT_API: "pyqt5" + CONDA_DEPENDENCIES: "pytest pyqt=5.*" + +platform: + -x64 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 + # If there is a newer build queued for the same PR, cancel this one. + # The AppVeyor 'rollout builds' option is supposed to serve the same + # purpose but it is problematic because it tends to cancel builds pushed + # directly to master instead of just PR builds (or the converse). + # credits: JuliaLang developers. + - ps: if ($env:APPVEYOR_PULL_REQUEST_NUMBER -and $env:APPVEYOR_BUILD_NUMBER -ne ((Invoke-RestMethod ` + https://ci.appveyor.com/api/projects/$env:APPVEYOR_ACCOUNT_NAME/$env:APPVEYOR_PROJECT_SLUG/history?recordsNumber=50).builds | ` + Where-Object pullRequestId -eq $env:APPVEYOR_PULL_REQUEST_NUMBER)[0].buildNumber) { ` + throw "There are newer queued builds for this pull request, failing early." } + - "git clone --depth 1 git://github.com/astropy/ci-helpers.git" + - "powershell ci-helpers/appveyor/install-miniconda.ps1" + - "SET PATH=%PYTHON%;%PYTHON%\\Scripts;%PATH%" + - "activate test" + - "pip install -e ." + +# Not a .NET project, we build in the install step instead +build: false test_script: - - C:\Python27\scripts\tox -e %TESTENVS% + - "%CMD_IN_ENV% python -m pytest tests/" diff --git a/scripts/install-qt.py b/scripts/install-qt.py deleted file mode 100644 index 2ad4f686..00000000 --- a/scripts/install-qt.py +++ /dev/null @@ -1,88 +0,0 @@ -""" -Simple script to install PyQt or PySide in CI (Travis and AppVeyor). -""" -from __future__ import print_function -import os -import sys -import subprocess -import urllib - - -if 'APPVEYOR' in os.environ: - def fix_registry(python_ver): - """Update install path on windows registry so PyQt installation installs at the correct - location. - python_ver must be "34", "27", etc. - """ - import _winreg as winreg - python_dir = r'C:\Python%s' % python_ver - print("Fixing registry %s..." % python_ver) - assert os.path.isdir(python_dir) - registry_key = r'Software\Python\PythonCore\%s.%s' % (python_ver[0], python_ver[1]) - with winreg.OpenKey(winreg.HKEY_CURRENT_USER, - registry_key, 0, - winreg.KEY_WRITE) as key: - winreg.SetValue(key, 'InstallPath', winreg.REG_SZ, python_dir) - - base_url = 'http://downloads.sourceforge.net/project/pyqt/' - downloads = { - 'py34-pyqt5': 'PyQt5/PyQt-5.5/PyQt5-5.5-gpl-Py3.4-Qt5.5.0-x32.exe', - 'py35-pyqt5': 'PyQt5/PyQt-5.6/PyQt5-5.6-gpl-Py3.5-Qt5.6.0-x32-2.exe', - 'py34-pyqt4': 'PyQt4/PyQt-4.11.4/PyQt4-4.11.4-gpl-Py3.4-Qt4.8.7-x32.exe', - 'py27-pyqt4': 'PyQt4/PyQt-4.11.4/PyQt4-4.11.4-gpl-Py2.7-Qt4.8.7-x32.exe', - } - if 'INSTALL_QT' in os.environ: - fix_registry('35') - caption = os.environ['INSTALL_QT'] - 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) - subprocess.check_call(cmdline) - print('OK') - else: - print('Skip install for this build') - -elif 'TRAVIS' in os.environ: - def apt_get_install(packages): - print('Installing %s...' % ', '.join(packages)) - subprocess.check_call(['sudo', 'apt-get', 'install', '-y', '-qq'] + packages) - - py3k = sys.version_info[0] == 3 - pyqt_version = {'pyqt4': 4, - 'pyqt4v2': 4, - 'pyqt5': 5, - } - if os.environ['PYTEST_QT_API'] in pyqt_version: - pyqt_ver = pyqt_version[os.environ['PYTEST_QT_API']] - if py3k: - pkg = 'python3-pyqt%s' % pyqt_ver - else: - pkg = 'python-qt%s' % pyqt_ver - apt_get_install([pkg]) - else: - if py3k: - pkg = 'python3-pyside' - else: - pkg = 'python-pyside' - apt_get_install([pkg]) - -else: - print('Nothing to do (not in Travis or AppVeyor)')