8000 Merge pull request #18134 from jkseppan/ci-macos · matplotlib/matplotlib@1caf17b · GitHub
[go: up one dir, main page]

Skip to content

Commit 1caf17b

Browse files
authored
Merge pull request #18134 from jkseppan/ci-macos
Build on xcode9
2 parents 2c170f4 + 968b063 commit 1caf17b

File tree

4 files changed

+85
-16
lines changed

4 files changed

+85
-16
lines changed

.travis.yml

Lines changed: 6 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -87,6 +87,7 @@ matrix:
8787
env:
8888
- PRE=--pre
8989
- os: osx
90+
osx_image: xcode9
9091
language: generic # https://github.com/travis-ci/travis-ci/issues/2312
9192
only: master
9293
cache:
@@ -101,26 +102,15 @@ matrix:
101102
allow_failures:
102103
- python: "nightly"
103104

104-
before_install: |
105+
before_install:
106+
- |
107+
# Install OS dependencies and set up ccache
105108
case "$TRAVIS_OS_NAME" in
106109
linux)
107110
export PATH=/usr/lib/ccache:$PATH
108111
;;
109112
osx)
110-
set -e
111-
ci/silence brew update
112-
brew uninstall numpy gdal postgis
113-
brew unlink python@2
114-
brew install python || brew upgrade python
115-
brew install ffmpeg imagemagick mplayer ccache
116-
hash -r
117-
which python
118-
python --version
119-
set +e
120-
# We could install ghostscript and inkscape here to test svg and pdf
121-
# but this makes the test time really long.
122-
# brew install ghostscript inkscape
123-
export PATH=/usr/local/opt/python/libexec/bin:/usr/local/opt/ccache/libexec:$PATH
113+
ci/osx-deps
124114
;;
125115
esac
126116
@@ -169,7 +159,7 @@ install:
169159
export CPPFLAGS=--coverage
170160
fi
171161
- |
172-
python -mpip install -ve . # Install Matplotlib.
162+
python -mpip install -e . # Install Matplotlib.
173163
- |
174164
if [[ $TRAVIS_OS_NAME != 'osx' ]]; then
175165
unset CPPFLAGS

ci/osx-deps

Lines changed: 65 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,65 @@
1+
#!/bin/bash
2+
3+
set -euo pipefail
4+
cache="$HOME"/.cache/matplotlib
5+
6+
fold_start() {
7+
key=$1
8+
title=$2
9+
echo -e "travis_fold:start:$key\e[2K"
10+
echo -e "travis_time:start:$key\e[2K"
11+
tick="$(date +%s)"
12+
echo "$title"
13+
}
14+
15+
fold_end() {
16+
key=$1
17+
tock="$(date +%s)"
18+
nano=000000000
19+
echo -e "travis_time:end:$key:start=$tick$nano,finish=$tock$nano,duration=$((tock - tick))$nano\e[2K"
20+
echo -e "travis_fold:end:$key\e[2K"
21+
}
22+
23+
cached_download() {
24+
file=$1
25+
url=$2
26+
shasum=$3
27+
path="$cache/$file"
28+
if [[ ! -f "$path"
29+
|| "$(shasum -a 256 "$path" | awk '{print $1}')" != "$shasum" ]]
30+
then
31+
curl -L -o "$path" "$url"
32+
fi
33+
}
34+
35+
fold_start Python "Install Python 3.8 from python.org"
36+
cached_download python-3.8.5-macosx10.9.pkg \
37+
https://www.python.org/ftp/python/3.8.5/python-3.8.5-macosx10.9.pkg \
38+
e27c5a510c10f830084fb9c60b9e9aa8719d92e4537a80e6b4252c02396f0d29
39+
sudo installer -package "$cache"/python-3.8.5-macosx10.9.pkg -target /
40+
sudo ln -s /usr/local/bin/python3 /usr/local/bin/python
41+
hash -r
42+
fold_end Python
43+
44+
fold_start ccache 'Install ccache (compile it ourselves)'
45+
cached_download ccache-3.7.11.tar.xz \
46+
https://github.com/ccache/ccache/releases/download/v3.7.11/ccache-3.7.11.tar.xz \
47+
8d450208099a4d202bd7df87caaec81baee20ce9dd62da91e9ea7b95a9072f68
48+
tar xf "$cache"/ccache-3.7.11.tar.xz
49+
pushd ccache-3.7.11
50+
./configure --prefix=/usr/local
51+
make -j2
52+
make install
53+
popd
54+
for compiler in clang clang++ cc gcc c++ g++; do
55+
ln -sf ccache /usr/local/bin/$compiler
56+
done
57+
fold_end ccache
58+
59+
fold_start freetype 'Install freetype (just unpack into the build directory)'
60+
cached_download freetype-2.6.1.tar.gz \
61+
https://download.savannah.gnu.org/releases/freetype/freetype-2.6.1.tar.gz \
62+
0a3c7dfbda6da1e8fce29232e8e96d987ababbbf71ebc8c75659e4132c367014
63+
mkdir -p build
64+
tar -x -C build -f "$cache"/freetype-2.6.1.tar.gz
65+
fold_end freetype

lib/matplotlib/tests/test_backend_qt.py

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,12 @@
99
import pytest
1010

1111

12+
try:
13+
from matplotlib.backends.qt_compat import QtGui
14+
except ImportError:
15+
pytestmark = pytest.mark.skip('No usable Qt5 bindings')
16+
17+
1218
@pytest.fixture
1319
def qt_core(request):
1420
backend, = request.node.get_closest_marker('backend').args

lib/matplotlib/tests/test_backends_interactive.py

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,12 @@
1818
# versions so we don't fail on missing backends.
1919

2020
def _get_testable_interactive_backends():
21+
try:
22+
from matplotlib.backends.qt_compat import QtGui # noqa
23+
have_qt5 = True
24+
except ImportError:
25+
have_qt5 = False
26+
2127
backends = []
2228
for deps, backend in [
2329
(["cairo", "gi"], "gtk3agg"),
@@ -39,6 +45,8 @@ def _get_testable_interactive_backends():
3945
reason = "{} cannot be imported".format(", ".join(missing))
4046
elif backend == 'macosx' and os.environ.get('TF_BUILD'):
4147
reason = "macosx backend fails on Azure"
48+
elif 'qt5' in backend and not have_qt5:
49+
reason = "no usable Qt5 bindings"
4250
if reason:
4351
backend = pytest.param(
4452
backend,

0 commit comments

Comments
 (0)
0