# -*- coding: utf-8; mode: tcl; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- vim:fenc=utf-8:ft=tcl:et:sw=4:ts=4:sts=4

PortSystem          1.0
PortGroup           python 1.0
PortGroup           github 1.0

github.setup        SciTools cartopy 0.18.0 v

name                py-${github.project}
revision            1
categories-append   science gis graphics
platforms           darwin
license             LGPL-3

maintainers         {petr @petrrr} openmaintainer

description         A library providing cartographic tools for python.

long_description    \
    Cartopy is a Python package designed to make drawing maps for data \
    analysis and visualisation as easy as possible. It makes use of the \
    powerful PROJ.4, numpy and shapely libraries and has a simple and \
    intuitive drawing interface to matplotlib for creating publication \
    quality maps.

homepage            https://scitools.org.uk/cartopy/

checksums           rmd160  1392f64ca3f85a3201e0802e169de3d20141dbf3 \
                    sha256  eeb461e3d8c73d7b8d76d9b70a423a3f30c360ab44b05e018e9b4eba25e55b53 \
                    size    14192567

python.versions     27 35 36 37 38 39

if {${name} ne ${subport}} {
    depends_build-append    port:py${python.version}-setuptools \
                            port:py${python.version}-cython \
                            port:py${python.version}-numpy \
                            port:pkgconfig

    # default
    depends_lib-append      port:proj4 \
                            port:geos \
                            port:py${python.version}-numpy \
                            port:py${python.version}-pyshp \
                            port:py${python.version}-shapely \
                            port:py${python.version}-six

    if {${python.version} == 27} {
        depends_lib-append  port:py${python.version}-futures
    }

    # optional (but keep port simple): plotting, epsg, ows
    depends_lib-append      port:py${python.version}-gdal \
                            port:py${python.version}-matplotlib \
                            port:py${python.version}-Pillow \
                            port:py${python.version}-scipy \
                            port:py${python.version}-epsg \
                            port:py${python.version}-owslib

    # Required for post-installation testing only.
    depends_run-append      port:py${python.version}-mock \
                            port:py${python.version}-pytest \
                            port:py${python.version}-filelock

    # Add search paths for proj4 binary and pkgconfig files to build/destroot env
    # Allows setup.py to identify proj4 non-standard location and build flags
    # https://trac.macports.org/ticket/56150
    set proj4_prefix         ${prefix}/lib/proj49
    build.env-append         PATH=${proj4_prefix}/bin:$env(PATH) \
                             PKG_CONFIG_PATH=${proj4_prefix}/lib/pkgconfig
    destroot.env-append      PATH=${proj4_prefix}/bin:$env(PATH)

    # Adding documentation
    post-destroot {
        set dest_doc ${destroot}${prefix}/share/doc/${subport}
        xinstall -d ${dest_doc}
        xinstall -m 0644 -W ${worksrcpath} README.md INSTALL \
            CHANGES COPYING COPYING.LESSER ${dest_doc}
    }

    livecheck.type  none
} else {
    github.livecheck.regex {([0-9.]+)}
}
