From 56fd5b8f18086ea234132a304d54ec45f591f05d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jouni=20K=2E=20Sepp=C3=A4nen?= Date: Sun, 2 Aug 2020 12:18:57 +0300 Subject: [PATCH 1/2] Backport PR #18134: Build on xcode9 --- .travis.yml | 22 +++++------------- ci/osx-deps | 65 +++++++++++++++++++++++++++++++++++++++++++++++++++++ 2 files changed, 71 insertions(+), 16 deletions(-) create mode 100755 ci/osx-deps diff --git a/.travis.yml b/.travis.yml index d3b9780d8105..92579db8a2c2 100644 --- a/.travis.yml +++ b/.travis.yml @@ -87,6 +87,7 @@ matrix: env: - PRE=--pre - os: osx + osx_image: xcode9 language: generic # https://github.com/travis-ci/travis-ci/issues/2312 only: master cache: @@ -101,26 +102,15 @@ matrix: allow_failures: - python: "nightly" -before_install: | +before_install: +- | + # Install OS dependencies and set up ccache case "$TRAVIS_OS_NAME" in linux) export PATH=/usr/lib/ccache:$PATH ;; osx) - set -e - ci/silence brew update - brew uninstall numpy gdal postgis - brew unlink python@2 - brew install python || brew upgrade python - brew install ffmpeg imagemagick mplayer ccache - hash -r - which python - python --version - set +e - # We could install ghostscript and inkscape here to test svg and pdf - # but this makes the test time really long. - # brew install ghostscript inkscape - export PATH=/usr/local/opt/python/libexec/bin:/usr/local/opt/ccache/libexec:$PATH + ci/osx-deps ;; esac @@ -169,7 +159,7 @@ install: export CPPFLAGS=--coverage fi - | - python -mpip install -ve . # Install Matplotlib. + python -mpip install -e . # Install Matplotlib. - | if [[ $TRAVIS_OS_NAME != 'osx' ]]; then unset CPPFLAGS diff --git a/ci/osx-deps b/ci/osx-deps new file mode 100755 index 000000000000..2f00bb9ffa67 --- /dev/null +++ b/ci/osx-deps @@ -0,0 +1,65 @@ +#!/bin/bash + +set -euo pipefail +cache="$HOME"/.cache/matplotlib + +fold_start() { + key=$1 + title=$2 + echo -e "travis_fold:start:$key\e[2K" + echo -e "travis_time:start:$key\e[2K" + tick="$(date +%s)" + echo "$title" +} + +fold_end() { + key=$1 + tock="$(date +%s)" + nano=000000000 + echo -e "travis_time:end:$key:start=$tick$nano,finish=$tock$nano,duration=$((tock - tick))$nano\e[2K" + echo -e "travis_fold:end:$key\e[2K" +} + +cached_download() { + file=$1 + url=$2 + shasum=$3 + path="$cache/$file" + if [[ ! -f "$path" + || "$(shasum -a 256 "$path" | awk '{print $1}')" != "$shasum" ]] + then + curl -L -o "$path" "$url" + fi +} + +fold_start Python "Install Python 3.8 from python.org" +cached_download python-3.8.5-macosx10.9.pkg \ + https://www.python.org/ftp/python/3.8.5/python-3.8.5-macosx10.9.pkg \ + e27c5a510c10f830084fb9c60b9e9aa8719d92e4537a80e6b4252c02396f0d29 +sudo installer -package "$cache"/python-3.8.5-macosx10.9.pkg -target / +sudo ln -s /usr/local/bin/python3 /usr/local/bin/python +hash -r +fold_end Python + +fold_start ccache 'Install ccache (compile it ourselves)' +cached_download ccache-3.7.11.tar.xz \ + https://github.com/ccache/ccache/releases/download/v3.7.11/ccache-3.7.11.tar.xz \ + 8d450208099a4d202bd7df87caaec81baee20ce9dd62da91e9ea7b95a9072f68 +tar xf "$cache"/ccache-3.7.11.tar.xz +pushd ccache-3.7.11 +./configure --prefix=/usr/local +make -j2 +make install +popd +for compiler in clang clang++ cc gcc c++ g++; do + ln -sf ccache /usr/local/bin/$compiler +done +fold_end ccache + +fold_start freetype 'Install freetype (just unpack into the build directory)' +cached_download freetype-2.6.1.tar.gz \ + https://download.savannah.gnu.org/releases/freetype/freetype-2.6.1.tar.gz \ + 0a3c7dfbda6da1e8fce29232e8e96d987ababbbf71ebc8c75659e4132c367014 +mkdir -p build +tar -x -C build -f "$cache"/freetype-2.6.1.tar.gz +fold_end freetype From 4ca9f0f914dc8232e50d2969e33731f1fa948d87 Mon Sep 17 00:00:00 2001 From: Thomas A Caswell Date: Mon, 14 Sep 2020 11:55:22 -0400 Subject: [PATCH 2/2] CI: skip qt, cairo, gobject related installs on OSX on travis On 2020-09-12 pyqt5 replaced their wheels to have a minimum OSX version of 10.13 which caused us to fallback to trying to build pyqt5 from the tar.gz. This in turn failed (because we do not have any of the qt development libraries installed and even if we did it would take a while). We have always been installing pyside2 from wheels, but an older version (5.13.2) that has a fatal-to-us bug. However the previously published pyqt5 wheels were, despite being labeled as 10.12 actually complied against 10.13 and failed to import. This cause our test suite to decide that we did not have a valid qt binding and skip the qt tests. Now that pyqt5 is (correctly) not installing we are falling back to pyside2 and hitting the bug in pyside2 (it is reported to fixed in the next release 5.14.0 but that only has wheels for 10.13). PyGObject, pycairo, and cariocffi also do not install on OSX 10.12 This skips trying to install pycairo, pygobjoct, pyqt5, and pyside2 on OSX on travis because they all fail to install on OSX 10.12. It will make our CI marginally faster and does not move the status quo of what we were actually testing. --- .travis.yml | 35 ++++++++++++++++++++++------------- 1 file changed, 22 insertions(+), 13 deletions(-) diff --git a/.travis.yml b/.travis.yml index 92579db8a2c2..59e6f5b3fb5f 100644 --- a/.travis.yml +++ b/.travis.yml @@ -133,19 +133,28 @@ install: # install was successful by trying to import the toolkit (sometimes, the # install appears to be successful but shared libraries cannot be loaded at # runtime, so an actual import is a better check). - python -mpip install --upgrade pycairo cairocffi>=0.8 - python -mpip install --upgrade PyGObject && - python -c 'import gi; gi.require_version("Gtk", "3.0"); from gi.repository import Gtk' && - echo 'PyGObject is available' || - echo 'PyGObject is not available' - python -mpip install --upgrade pyqt5 && - python -c 'import PyQt5.QtCore' && - echo 'PyQt5 is available' || - echo 'PyQt5 is not available' - python -mpip install --upgrade pyside2 && - python -c 'import PySide2.QtCore' && - echo 'PySide2 is available' || - echo 'PySide2 is not available' + + # PyGObject, pycairo, and cariocffi do not install on OSX 10.12 + + # There are not functioning wheels available for OSX 10.12 (as of + # Sept 2020) for either pyqt5 (there are only wheels for 10.13+) + # or pyside2 (the latest version (5.13.2) with 10.12 wheels has a + # fatal to us bug, it was fixed in 5.14.0 which has 10.13 wheels) + if [[ $TRAVIS_OS_NAME != 'osx' ]]; then + python -mpip install --upgrade pycairo cairocffi>=0.8 + python -mpip install --upgrade PyGObject && + python -c 'import gi; gi.require_version("Gtk", "3.0"); from gi.repository import Gtk' && + echo 'PyGObject is available' || + echo 'PyGObject is not available' + python -mpip install --upgrade pyqt5 && + python -c 'import PyQt5.QtCore' && + echo 'PyQt5 is available' || + echo 'PyQt5 is not available' + python -mpip install --upgrade pyside2 && + python -c 'import PySide2.QtCore' && + echo 'PySide2 is available' || + echo 'PySide2 is not available' + fi python -mpip install --upgrade \ -f https://extras.wxpython.org/wxPython4/extras/linux/gtk3/ubuntu-16.04 \ wxPython &&