Skip to content
Merged
Show file tree
Hide file tree
Changes from 21 commits
Commits
Show all changes
24 commits
Select commit Hold shift + click to select a range
2bd6da9
Test gmt-python with GMT master branch
seisman Dec 4, 2018
3779968
Fix stickler-ci
seisman Jan 16, 2019
a04bf4b
Fix travis.yml
seisman Jan 16, 2019
af904da
Check GMT install
seisman Jan 16, 2019
f19318e
Source gmt install script
seisman Jan 16, 2019
7950c56
Update the build script with the new GMT build
leouieda Jan 21, 2019
988bab0
Avoid the name conflict with the Python package
leouieda Jan 21, 2019
d3e76f0
No line break
leouieda Jan 21, 2019
82cabf6
Delegate building GMT to a helper script
leouieda Jan 21, 2019
69b740a
Build on testing
leouieda Jan 21, 2019
436ea2d
Get around cloning into the cached directory
leouieda Jan 21, 2019
98c2185
Set the environment variables globaly
leouieda Jan 21, 2019
ae6029b
Don't try to set TEST
leouieda Jan 21, 2019
2d85ad6
Try using the experimental branch from GMT
leouieda Jan 21, 2019
3dd2719
Revert back to the master branch of GMT
leouieda Jan 21, 2019
be4378d
Remove GMT and twine from the dependencies
leouieda Jan 21, 2019
58da665
Merge branch 'master' into test-gmt-master
leouieda Jan 21, 2019
1ef43f3
Fix failure of basemap
leouieda Jan 21, 2019
d74dc6f
Merge branch 'test-gmt-master' of github.com:GenericMappingTools/gmt-…
leouieda Jan 21, 2019
f72a706
The lib dir is lib64
leouieda Jan 21, 2019
b977d70
Set the library path using GMT_LIBRARY_PATH
leouieda Jan 21, 2019
87a6517
Update install docs
leouieda Jan 21, 2019
b115d20
Remove unnecessary dependencies
leouieda Jan 21, 2019
0f01277
Try to not build GMT with debug or testing
leouieda Jan 21, 2019
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
57 changes: 51 additions & 6 deletions .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,10 @@ language: generic
# Use the container builds so we don't need sudo priviledges
sudo: false

cache:
directories:
- gmt-master/build

# Only build pushes to the master branch and tags. This avoids the double
# builds than happen when working on a branch instead of a fork.
branches:
Expand All @@ -14,6 +18,39 @@ branches:
# Regex to build tagged commits with version numbers
- /\d+\.\d+(\.\d+)?(\S*)?$/

# Set the Ubuntu version for the Linux builds
dist: xenial

# GMT dependencies for the Linux and OSX builds
addons:
apt:
packages:
- cmake
- build-essential
- libcurl4-gnutls-dev
- libnetcdf-dev
- libgdal1-dev
- libfftw3-dev
- libpcre3-dev
- liblapack-dev
- ghostscript
- curl
- graphicsmagick
Copy link
Member Author

Choose a reason for hiding this comment

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

No need to install graphicsmagick, python and python-pip here, since they're used by GMT to do tests and build documentations.

Copy link
Member

Choose a reason for hiding this comment

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

Right, good catch

- python
- python-pip
homebrew:
packages:
- cmake
- curl
- netcdf
- gdal
- fftw
- pcre2
- ghostscript
- curl
- graphicsmagick
- python

# Define environment variables common to all builds
env:
global:
Expand All @@ -23,12 +60,15 @@ env:
# TWINE_PASSWORD to deploy to PyPI
- secure: "md4fgPt9RC/sCoN5//5PcNHLUd9gWQGewV5hFpWW88MRTjxTng1Zfs8r7SqlF2AkEEepFfyzq0BEe9c3FMAnFbec3KmqdlQen4V8xDbLrcTlvkPlTrYGbAScUvdhhqojB//hMHoTD4KvxAv9CiUwFBO4hCMmj2buWHUbV9Ksu5WCW9mF/gkt/hIuYAU6Mbwt8PiYyMgUpzMHO1vruofcWRaVnvKwmBqHB0ae86D4/drpwn4CWjlM12WUnphT2bssiyPkw24FZtCN6kPVta6bLZKBxu0bZpw2vbXuUG+Yh19Q4mp8wNYT3XSHJf8Hl5LfujF48+cLWu+6rlCkdcelyVylhWLFc3rGOONAv4G8jWW2yNSz/bLQfJnMpd81fQEu5eySmFxB7mdB0uyKpvIG1jMJQ73LlYKakKLAPdYhMFyQAHoX9gvCE3S4QR95DBMi5gM/pZubOCcMLdjPHB5JKpJHSjxbOzyVwgmsUIEgd5Bi2vZvvYQXn1plk4xpQ3PhXc+/gi33bzY89mKcfOn0HJ2pD1vLqDXRCBsMCakoLZ0JB/6bacaz4FngbsGWuQ+I1cz20lJGL/MSi9bW1G7Uoidt3GXXWDmXrWt70vIXlLIxr8XV0Mu/rPbauGgWE+ZSYEfvdM5sP+FNF7vQ5de+Fkvzg5Z3tTfR+O1W+d7+vM4="
- TWINE_USERNAME=Leonardo.Uieda
# Paths for GMT installation
- INSTALLDIR="$HOME/gmt-install-dir"
- COASTLINEDIR="$INSTALLDIR/coast"
- PATH="$INSTALLDIR/bin:$PATH"
- LD_LIBRARY_PATH="$INSTALLDIR/lib:$LD_LIBRARY_PATH"
- GMT_LIBRARY_PATH="$INSTALLDIR/lib"
# The file with the listed requirements to be installed by conda
- CONDA_REQUIREMENTS=requirements.txt
- CONDA_REQUIREMENTS_DEV=requirements-dev.txt
# Get GMT6 from conda-forge development channel
- CONDA_INSTALL_EXTRA="gmt=6.0.0*"
- CONDA_EXTRA_CHANNEL=conda-forge/label/dev
# These variables control which actions are performed in a build
- TEST=false
- CHECK=false
Expand All @@ -44,8 +84,7 @@ matrix:
env:
- PYTHON=3.6
- CHECK=true
# Don't need to install everything just to run the style checks
- CONDA_INSTALL_EXTRA="black flake8 pylint"
- CONDA_INSTALL_EXTRA="black flake8 pylint=2.2.2"
- CONDA_REQUIREMENTS=""
- CONDA_REQUIREMENTS_DEV=""
- name: "Linux - Python 3.7"
Expand All @@ -54,14 +93,15 @@ matrix:
- PYTHON=3.7
- TEST=true
- BUILD_DOCS=true
- name: "Linux - Python 3.6 (also deploys)"
- name: "Linux - Python 3.6 (deploy)"
os: linux
env:
- PYTHON=3.6
- TEST=true
- BUILD_DOCS=true
- DEPLOY_DOCS=true
- DEPLOY_PYPI=true
- CONDA_INSTALL_EXTRA="twine"
- name: "Mac - Python 3.7"
os: osx
env:
Expand All @@ -76,6 +116,11 @@ matrix:
- BUILD_DOCS=true

before_install:
# Build and install GMT from the master branch
- if [ "$TEST" == "true" ]; then
bash helpers/build-gmt-master.sh;
fi
- cd "$TRAVIS_BUILD_DIR"
# Get the Fatiando CI scripts
- git clone https://github.com/fatiando/continuous-integration.git
# Download and install miniconda and setup dependencies
Expand Down
3 changes: 0 additions & 3 deletions environment.yml
Original file line number Diff line number Diff line change
@@ -1,11 +1,9 @@
name: gmt-python
channels:
- conda-forge
- conda-forge/label/dev
dependencies:
- python=3.6
- pip
- gmt=6.0.0*
- numpy
- pandas
- xarray
Expand All @@ -25,4 +23,3 @@ dependencies:
- sphinx_rtd_theme
- nbsphinx
- numpydoc
- twine
8 changes: 0 additions & 8 deletions gmt/base_plotting.py
Original file line number Diff line number Diff line change
Expand Up @@ -445,12 +445,6 @@ def basemap(self, **kwargs):
{J}
{R}
{B}
D : str
``'[unit]xmin/xmax/ymin/ymax[r][+sfile][+t]'``
Draw a simple map insert box on the map. Requires *F*.
F : bool or str
Without further options, draws a rectangular border around any map
insert (*D*), map scale (*L*) or map rose (*T*).
L : str
``'[g|j|J|n|x]refpoint'``
Draws a simple map scale centered on the reference point specified.
Expand All @@ -466,8 +460,6 @@ def basemap(self, **kwargs):
kwargs = self._preprocess(**kwargs)
if not ("B" in kwargs or "L" in kwargs or "T" in kwargs):
raise GMTInvalidInput("At least one of B, L, or T must be specified.")
if "D" in kwargs and "F" not in kwargs:
raise GMTInvalidInput("Option D requires F to be specified as well.")
with Session() as lib:
lib.call_module("basemap", build_arg_string(kwargs))

Expand Down
Binary file removed gmt/tests/baseline/test_basemap_d.png
Binary file not shown.
15 changes: 0 additions & 15 deletions gmt/tests/test_basemap.py
Original file line number Diff line number Diff line change
Expand Up @@ -14,21 +14,6 @@ def test_basemap_required_args():
fig.basemap(R="10/70/-3/8", J="X4i/3i")


@pytest.mark.mpl_image_compare
def test_basemap_d():
"Make sure the D option works"
fig = Figure()
fig.basemap(R="10/70/-300/800", J="X3i/5i", B="af", D="30/35/-200/500", F=True)
return fig


def test_basemap_d_raises():
"Make sure the D raises an error when F not given."
fig = Figure()
with pytest.raises(GMTInvalidInput):
fig.basemap(R="10/70/-300/800", J="X3i/5i", B="af", D="30/35/-200/500")


@pytest.mark.mpl_image_compare
def test_basemap():
"Create a simple basemap plot"
Expand Down
6 changes: 3 additions & 3 deletions gmt/tests/test_figure.py
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@ def test_figure_region_country_codes():
def test_figure_savefig_exists():
"Make sure the saved figure has the right name"
fig = Figure()
fig.basemap(region="10/70/-300/800", J="X3i/5i", B="af", D="30/35/-200/500", F=True)
fig.basemap(region="10/70/-300/800", J="X3i/5i", B="af")
prefix = "test_figure_savefig_exists"
for fmt in "png pdf jpg bmp eps tif".split():
fname = ".".join([prefix, fmt])
Expand All @@ -60,7 +60,7 @@ def test_figure_savefig_exists():
def test_figure_savefig_transparent():
"Check if fails when transparency is not supported"
fig = Figure()
fig.basemap(region="10/70/-300/800", J="X3i/5i", B="af", D="30/35/-200/500", F=True)
fig.basemap(region="10/70/-300/800", J="X3i/5i", B="af")
prefix = "test_figure_savefig_transparent"
for fmt in "pdf jpg bmp eps tif".split():
fname = ".".join([prefix, fmt])
Expand Down Expand Up @@ -112,6 +112,6 @@ def mock_psconvert(*args, **kwargs): # pylint: disable=unused-argument
def test_figure_show():
"Test that show creates the correct file name and deletes the temp dir"
fig = Figure()
fig.basemap(R="10/70/-300/800", J="X3i/5i", B="af", D="30/35/-200/500", F=True)
fig.basemap(R="10/70/-300/800", J="X3i/5i", B="af")
img = fig.show(width=800)
assert img.width == 800
16 changes: 16 additions & 0 deletions helpers/build-gmt-master.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
#!/bin/bash
# Download and build the GMT master branch. Used by TravisCI.

set -e

mkdir -p "$INSTALLDIR"
mkdir -p "$COASTLINEDIR"
git clone --depth=1 --branch=master https://github.com/GenericMappingTools/gmt.git tmp
Copy link
Member Author

Choose a reason for hiding this comment

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

Why not clone it to gmt-master directly? Any side-effects?

Copy link
Member

Choose a reason for hiding this comment

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

It's because of the cache. I'm having Travis cache gmt-master/build so we don't recompile things that didn't change. But git won't checkout into an existing directory.

Copy link
Member Author

Choose a reason for hiding this comment

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

Got it.

mkdir -p gmt-master
cp -r tmp/* gmt-master
rm -rf tmp
cd gmt-master
bash ci/download-coastlines.sh
bash ci/build-gmt.sh

set +e
2 changes: 0 additions & 2 deletions requirements-dev.txt
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,5 @@ sphinx
sphinx_rtd_theme
nbsphinx
numpydoc
twine
# The following are installed for checking possible conflicts
basemap