Skip to content

Commit f792069

Browse files
committed
Using Python script to install qt on travis
1 parent 86b47b3 commit f792069

File tree

2 files changed

+27
-13
lines changed

2 files changed

+27
-13
lines changed

.travis.yml

Lines changed: 2 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -14,19 +14,8 @@ env:
1414
- PYTEST_VERSION=2.6.0 PYTEST_QT_FORCE_PYQT=false
1515

1616
install:
17-
# PySide
18-
- if [[ "$PYTEST_QT_FORCE_PYQT" == "false" && "$TRAVIS_PYTHON_VERSION" == "2.7" ]]; then
19-
- sudo apt-get install -qq python-pyside;
20-
- elif [[ "$PYTEST_QT_FORCE_PYQT" == "false" && "$TRAVIS_PYTHON_VERSION" == "3.2" ]]; then
21-
- sudo apt-get install -qq python3-pyside;
22-
- fi
23-
24-
# PyQt4
25-
- if [[ "$PYTEST_QT_FORCE_PYQT" == "true" && "$TRAVIS_PYTHON_VERSION" == "2.7" ]]; then
26-
- sudo apt-get install -qq python-qt4
27-
- elif [[ "$PYTEST_QT_FORCE_PYQT" == "true" && "$TRAVIS_PYTHON_VERSION" == "3.2" ]]; then
28-
- sudo apt-get install -qq python3-pyqt4
29-
- fi
17+
# Qt
18+
- python install-qt.py
3019

3120
# PyTest
3221
- pip uninstall -y pytest

install-qt.py

Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
'''
2+
Simple script to install PyQt or PySide based on PYTEST_QT_FORCE_PYQT
3+
and python version. Meant to be used in travis-ci.
4+
'''
5+
import os
6+
import sys
7+
8+
def run(cmd):
9+
print cmd
10+
r = os.system(cmd)
11+
if r != 0:
12+
sys.exit('command %s failed with status %s' % (cmd, r))
13+
14+
py3k = sys.version_info[0] == 3
15+
if os.environ['PYTEST_QT_FORCE_PYQT'] == "true":
16+
if py3k:
17+
run('sudo apt-get install -qq python3-pyqt4')
18+
else:
19+
run('sudo apt-get install -qq python-qt4')
20+
else:
21+
if py3k:
22+
run('sudo apt-get install -qq python3-pyside')
23+
else:
24+
run('sudo apt-get install -qq python-pyside')
25+

0 commit comments

Comments
 (0)