Skip to content

Build on xcode9 #18134

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 14 commits into from
Aug 2, 2020
22 changes: 6 additions & 16 deletions .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Expand All @@ -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

Expand Down Expand Up @@ -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
Expand Down
65 changes: 65 additions & 0 deletions ci/osx-deps
Original file line number Diff line number Diff line change
@@ -0,0 +1,65 @@
#!/bin/bash

set -euo pipefail
cache="$HOME"/.cache/matplotlib

fold_start() {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🤯

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
6 changes: 6 additions & 0 deletions lib/matplotlib/tests/test_backend_qt.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,12 @@
import pytest


try:
from matplotlib.backends.qt_compat import QtGui
except ImportError:
pytestmark = pytest.mark.skip('No usable Qt5 bindings')


@pytest.fixture
def qt_core(request):
backend, = request.node.get_closest_marker('backend').args
Expand Down
8 changes: 8 additions & 0 deletions lib/matplotlib/tests/test_backends_interactive.py
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,12 @@
# versions so we don't fail on missing backends.

def _get_testable_interactive_backends():
try:
from matplotlib.backends.qt_compat import QtGui # noqa
have_qt5 = True
except ImportError:
have_qt5 = False

backends = []
for deps, backend in [
(["cairo", "gi"], "gtk3agg"),
Expand All @@ -39,6 +45,8 @@ def _get_testable_interactive_backends():
reason = "{} cannot be imported".format(", ".join(missing))
elif backend == 'macosx' and os.environ.get('TF_BUILD'):
reason = "macosx backend fails on Azure"
elif 'qt5' in backend and not have_qt5:
reason = "no usable Qt5 bindings"
if reason:
backend = pytest.param(
backend,
Expand Down