From 05e6c0cb7679c6af7db869cd9af2384830dbf7ae Mon Sep 17 00:00:00 2001 From: John Wiggins Date: Sun, 30 Aug 2015 13:50:03 +0200 Subject: [PATCH 1/4] Fix some things on Travis - Now using the latest pip - imread wasn't actually being installed - Optional package installation uses a requirements file - `python setup.py develop` instead of the previous two-step. --- .travis.yml | 18 ++++++++---------- optional_requirements.txt | 5 +++++ tools/travis_script.sh | 20 +++----------------- 3 files changed, 16 insertions(+), 27 deletions(-) create mode 100644 optional_requirements.txt diff --git a/.travis.yml b/.travis.yml index 442264ab..791631b4 100644 --- a/.travis.yml +++ b/.travis.yml @@ -8,8 +8,7 @@ language: python sudo: false cache: - directories: - - $HOME/.cache/pip + - pip addons: apt: packages: @@ -28,14 +27,14 @@ notifications: on_start: false # default: false python: -- 2.6 -- 2.7 -- 3.2 -- 3.3 -- 3.4 + - 2.6 + - 2.7 + - 3.2 + - 3.3 + - 3.4 before_install: - - sudo apt-get update; true + - pip install --upgrade pip - source tools/travis_before_install.sh - which python; python --version @@ -43,8 +42,7 @@ before_install: - tools/build_versions.py install: - - python setup.py build_ext --inplace - - python setup.py install + - python setup.py develop script: tools/travis_script.sh diff --git a/optional_requirements.txt b/optional_requirements.txt new file mode 100644 index 00000000..cd98c274 --- /dev/null +++ b/optional_requirements.txt @@ -0,0 +1,5 @@ +PySide; python_version != '2.7' +imread; python_version != '3.2' +SimpleITK; python_version != '3.2' and python_version != '3.4' +astropy +tifffile diff --git a/tools/travis_script.sh b/tools/travis_script.sh index 3c459ac7..27f0615e 100755 --- a/tools/travis_script.sh +++ b/tools/travis_script.sh @@ -20,6 +20,9 @@ section_end "Flake8.test" section "Install.optional.dependencies" +# Install most of the optional packages +pip install --retries 3 -q -r ./optional_requirements.txt $WHEELHOUSE + # Install Qt and then update the Matplotlib settings if [[ $PY == 2.7* ]]; then # http://stackoverflow.com/a/9716100 @@ -37,30 +40,13 @@ if [[ $PY == 2.7* ]]; then done else - retry pip install -q PySide $WHEELHOUSE python ~/venv/bin/pyside_postinstall.py -install -fi - -# Install imread from wheelhouse if available (not 3.2) -if [[ $PY != 3.2 ]]; then - retry pip install -q $WHEELHOUSE fi -# Install SimpleITK from wheelhouse if available (not 3.2 or 3.4) -if [[ $PY =~ 3\.[24] ]]; then - echo "SimpleITK unavailable on $PY" -else - retry pip install -q SimpleITK $WHEELHOUSE -fi - -retry pip install -q astropy $WHEELHOUSE - if [[ $PY == 2.* ]]; then retry pip install -q pyamg fi -retry pip install -q tifffile - section_end "Install.optional.dependencies" From 8a5cc800cb3ed5ad55bb7b2d765b457953753ce5 Mon Sep 17 00:00:00 2001 From: John Wiggins Date: Mon, 31 Aug 2015 20:26:22 +0200 Subject: [PATCH 2/4] Revert pip cache changes. Use pip's built-in retry. --- .travis.yml | 6 ++++-- tools/travis_before_install.sh | 6 +++--- tools/travis_notes.txt | 5 +++-- tools/travis_script.sh | 2 +- 4 files changed, 11 insertions(+), 8 deletions(-) diff --git a/.travis.yml b/.travis.yml index 791631b4..1a74ef3e 100644 --- a/.travis.yml +++ b/.travis.yml @@ -8,7 +8,9 @@ language: python sudo: false cache: - - pip + # See http://docs.travis-ci.com/user/caching/#pip-cache + directories: + - $HOME/.cache/pip addons: apt: packages: @@ -34,7 +36,7 @@ python: - 3.4 before_install: - - pip install --upgrade pip + - pip install -U pip - source tools/travis_before_install.sh - which python; python --version diff --git a/tools/travis_before_install.sh b/tools/travis_before_install.sh index fce0a367..3cbb08b4 100755 --- a/tools/travis_before_install.sh +++ b/tools/travis_before_install.sh @@ -49,7 +49,7 @@ fi virtualenv -p python ~/venv source ~/venv/bin/activate -retry pip install -q wheel flake8 coveralls nose +pip install --retries 3 -q wheel flake8 coveralls nose # on Python 3.2, use matplotlib 1.3.1 if [[ $TRAVIS_PYTHON_VERSION == 3.2 ]]; then @@ -60,9 +60,9 @@ fi for requirement in $WHEELBINARIES; do WHEELS="$WHEELS $(grep $requirement requirements.txt)" done -retry pip install -q $WHEELHOUSE $WHEELS +pip install --retries 3 -q $WHEELHOUSE $WHEELS -retry pip install -q -r requirements.txt +pip install --retries 3 -q -r requirements.txt section () { diff --git a/tools/travis_notes.txt b/tools/travis_notes.txt index 84271821..0b18aeb1 100644 --- a/tools/travis_notes.txt +++ b/tools/travis_notes.txt @@ -14,8 +14,9 @@ the yaml file is valid. set -ex ``` -- Use the `retry` bash function from `before_install.sh` before a command to have it try 3 times before -failing (useful for installing from third party sources). +- Use the `retry` bash function from `before_install.sh` before a command to +have it try 3 times before failing. +- Use `pip install --retries N` for retrying package downloads. - Use the `section` function to start a folded section of the script. Section names must have underscores or dots instead of spaces and must be accompanied by a corresponding `section_end` call. diff --git a/tools/travis_script.sh b/tools/travis_script.sh index 27f0615e..65fc85c5 100755 --- a/tools/travis_script.sh +++ b/tools/travis_script.sh @@ -44,7 +44,7 @@ else fi if [[ $PY == 2.* ]]; then - retry pip install -q pyamg + pip install --retries 3 -q pyamg fi section_end "Install.optional.dependencies" From 0e46d2cd82e74c24b87aa45e1e36992d5445b69f Mon Sep 17 00:00:00 2001 From: John Wiggins Date: Tue, 1 Sep 2015 08:59:15 +0200 Subject: [PATCH 3/4] Make sure the pip in the virtualenv is upgraded. Additionally, list the installed packages after each of the two installation phases. --- .travis.yml | 1 - tools/travis_before_install.sh | 3 +++ tools/travis_script.sh | 3 +++ 3 files changed, 6 insertions(+), 1 deletion(-) diff --git a/.travis.yml b/.travis.yml index 1a74ef3e..eeb21d97 100644 --- a/.travis.yml +++ b/.travis.yml @@ -36,7 +36,6 @@ python: - 3.4 before_install: - - pip install -U pip - source tools/travis_before_install.sh - which python; python --version diff --git a/tools/travis_before_install.sh b/tools/travis_before_install.sh index 3cbb08b4..09f67451 100755 --- a/tools/travis_before_install.sh +++ b/tools/travis_before_install.sh @@ -49,6 +49,7 @@ fi virtualenv -p python ~/venv source ~/venv/bin/activate +pip install --upgrade pip pip install --retries 3 -q wheel flake8 coveralls nose # on Python 3.2, use matplotlib 1.3.1 @@ -64,6 +65,8 @@ pip install --retries 3 -q $WHEELHOUSE $WHEELS pip install --retries 3 -q -r requirements.txt +# Show what's installed +pip list section () { echo -en "travis_fold:start:$1\r" diff --git a/tools/travis_script.sh b/tools/travis_script.sh index 65fc85c5..efa3071e 100755 --- a/tools/travis_script.sh +++ b/tools/travis_script.sh @@ -47,6 +47,9 @@ if [[ $PY == 2.* ]]; then pip install --retries 3 -q pyamg fi +# Show what's installed +pip list + section_end "Install.optional.dependencies" From b91f6acb8ff64cb5f1e67ff1e0f7d2308ea39acc Mon Sep 17 00:00:00 2001 From: John Wiggins Date: Tue, 1 Sep 2015 19:58:08 +0200 Subject: [PATCH 4/4] Remove imread from the optional requirements for 2.7 --- optional_requirements.txt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/optional_requirements.txt b/optional_requirements.txt index cd98c274..fe6503c5 100644 --- a/optional_requirements.txt +++ b/optional_requirements.txt @@ -1,5 +1,5 @@ PySide; python_version != '2.7' -imread; python_version != '3.2' +imread; python_version != '2.7' and python_version != '3.2' SimpleITK; python_version != '3.2' and python_version != '3.4' astropy tifffile