mirror of
https://github.com/wassname/scikit-image.git
synced 2026-06-27 18:25:32 +08:00
Merge pull request #1253 from blink1073/travis-venv
Use new Virtual Environments for Travis
This commit is contained in:
+6
-1
@@ -9,7 +9,7 @@ language: python
|
||||
|
||||
python:
|
||||
- 2.6
|
||||
- "2.7_with_system_site_packages"
|
||||
- 2.7
|
||||
- 3.2
|
||||
- 3.3
|
||||
- 3.4
|
||||
@@ -18,8 +18,13 @@ before_install:
|
||||
- export DISPLAY=:99.0
|
||||
- export PYTHONWARNINGS="all"
|
||||
- export WHEELHOUSE="--no-index --find-links=http://travis-wheels.scikit-image.org/"
|
||||
- sudo apt-get update
|
||||
|
||||
- travis_retry tools/travis_setup.sh
|
||||
|
||||
- source ~/venv/bin/activate
|
||||
- which python
|
||||
- python --version
|
||||
- python check_bento_build.py
|
||||
|
||||
- tools/header.py "Dependency versions"
|
||||
|
||||
+1
-1
@@ -4,4 +4,4 @@ numpy>=1.6.1
|
||||
scipy>=0.9
|
||||
six>=1.3
|
||||
networkx>=1.8
|
||||
pillow>=1.1.7
|
||||
pillow>=1.7.8
|
||||
|
||||
@@ -35,7 +35,7 @@ DEPENDENCIES = {}
|
||||
with open('requirements.txt', 'rb') as fid:
|
||||
data = fid.read().decode('utf-8', 'replace')
|
||||
for line in data.splitlines():
|
||||
pkg, _, version_info = line.partition('>=')
|
||||
pkg, _, version_info = line.replace('==', '>=').partition('>=')
|
||||
# Only require Cython if we have a developer checkout
|
||||
if pkg.lower() == 'cython' and not VERSION.endswith('dev'):
|
||||
continue
|
||||
@@ -88,22 +88,29 @@ def check_requirements():
|
||||
for (package_name, min_version) in DEPENDENCIES.items():
|
||||
if package_name == 'cython':
|
||||
package_name = 'Cython'
|
||||
dep_error = False
|
||||
dep_error = ''
|
||||
if package_name.lower() == 'pillow':
|
||||
package_name = 'PIL.Image'
|
||||
min_version = '1.1.7'
|
||||
try:
|
||||
package = __import__(package_name,
|
||||
fromlist=[package_name.rpartition('.')[0]])
|
||||
except ImportError:
|
||||
dep_error = True
|
||||
dep_error = ('You need `%s` version %s or later.'
|
||||
% (package_name, min_version))
|
||||
else:
|
||||
package_version = get_package_version(package)
|
||||
if package_name == 'PIL':
|
||||
package_version = package.PILLOW_VERSION
|
||||
else:
|
||||
package_version = get_package_version(package)
|
||||
|
||||
if LooseVersion(min_version) > LooseVersion(package_version):
|
||||
dep_error = True
|
||||
dep_error = ('You need `%s` version %s or later,'
|
||||
'found version %s.'
|
||||
% (package_name, min_version,
|
||||
package_version))
|
||||
if dep_error:
|
||||
raise ImportError('You need `%s` version %s or later.' \
|
||||
% (package_name, min_version))
|
||||
raise ImportError(dep_error)
|
||||
|
||||
|
||||
if __name__ == "__main__":
|
||||
|
||||
@@ -7,10 +7,24 @@ tools/header.py "Install optional dependencies"
|
||||
if [[ $TRAVIS_PYTHON_VERSION == 2.7* ]]; then
|
||||
sudo apt-get install -q python-qt4
|
||||
|
||||
# http://stackoverflow.com/a/9716100
|
||||
LIBS=( PyQt4 sip.so )
|
||||
|
||||
VAR=( $(which -a python$TRAVIS_PYTHON_VERSION) )
|
||||
|
||||
GET_PYTHON_LIB_CMD="from distutils.sysconfig import get_python_lib; print (get_python_lib())"
|
||||
LIB_VIRTUALENV_PATH=$(python -c "$GET_PYTHON_LIB_CMD")
|
||||
LIB_SYSTEM_PATH=$(${VAR[-1]} -c "$GET_PYTHON_LIB_CMD")
|
||||
|
||||
for LIB in ${LIBS[@]}
|
||||
do
|
||||
sudo ln -s $LIB_SYSTEM_PATH/$LIB $LIB_VIRTUALENV_PATH/$LIB
|
||||
done
|
||||
|
||||
else
|
||||
sudo apt-get install -q libqt4-dev
|
||||
pip install -q PySide $WHEELHOUSE
|
||||
python ~/virtualenv/python${TRAVIS_PYTHON_VERSION}/bin/pyside_postinstall.py -install
|
||||
python ~/venv/bin/pyside_postinstall.py -install
|
||||
fi
|
||||
|
||||
# imread does NOT support py3.2
|
||||
@@ -25,7 +39,7 @@ if [[ $TRAVIS_PYTHON_VERSION != 3.4 ]]; then
|
||||
fi
|
||||
|
||||
sudo apt-get install -q libfreeimage3
|
||||
pip install -q astropy
|
||||
pip install -q astropy $WHEELHOUSE
|
||||
|
||||
if [[ $TRAVIS_PYTHON_VERSION == 2.* ]]; then
|
||||
pip install -q pyamg
|
||||
|
||||
+18
-7
@@ -2,20 +2,31 @@
|
||||
set -ex
|
||||
|
||||
sh -e /etc/init.d/xvfb start
|
||||
sudo apt-get update
|
||||
|
||||
pip install wheel flake8 coveralls nose
|
||||
pip uninstall -y numpy
|
||||
|
||||
# on Python 2.7, use the system versions of numpy, scipy, and matplotlib
|
||||
# and the minimum version of cython and networkx
|
||||
if [[ $TRAVIS_PYTHON_VERSION == 2.7* ]]; then
|
||||
virtualenv -p python --system-site-packages ~/venv
|
||||
sudo apt-get install python-scipy python-matplotlib
|
||||
pip install https://github.com/cython/cython/archive/0.19.2.tar.gz
|
||||
pip install https://github.com/networkx/networkx/archive/networkx-1.8.tar.gz
|
||||
sed -i 's/cython>=/cython==/g' requirements.txt
|
||||
sed -i 's/networkx>=/networkx==/g' requirements.txt
|
||||
else
|
||||
virtualenv -p python --system-site-packages ~/venv
|
||||
fi
|
||||
|
||||
pip install -r requirements.txt $WHEELHOUSE
|
||||
source ~/venv/bin/activate
|
||||
pip install wheel flake8 coveralls nose
|
||||
|
||||
# install system tk for matplotlib
|
||||
sudo apt-get install python-tk
|
||||
|
||||
|
||||
# on Python 3.2, use matplotlib 1.3.1
|
||||
if [[ $TRAVIS_PYTHON_VERSION == 2.7* ]]; then
|
||||
sed -i 's/matplotlib>=*.*.*/matplotlib==1.3.1/g' requirements.txt
|
||||
fi
|
||||
|
||||
pip install $WHEELHOUSE -r requirements.txt
|
||||
|
||||
# clean up disk space
|
||||
sudo apt-get clean
|
||||
|
||||
Reference in New Issue
Block a user