# -*- 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               active_variants 1.1

name                    py-healpy
version                 1.14.0
categories-append       science
license                 GPL-2
platforms               darwin
maintainers             {aronnax @lpsinger} openmaintainer
description             Python language interface for HEALPix
long_description \
  Software for pixelization, hierarchical indexing, synthesis, analysis, and \
  visualization of data on the sphere. This is the ${description}.

distname                ${python.rootname}-${version}
master_sites            pypi:[string index ${python.rootname} 0]/${python.rootname}/
homepage                https://pypi.python.org/pypi/${python.rootname}/

checksums               rmd160  f7ca02a0cbdee35b7bab350f47b5a85a6012677f \
                        sha256  2720b5f96c314bdfdd20b6ffc0643ac8091faefcf8fd20a4083cedff85a66c5e \
                        size    4802425

python.versions         27 35 36 37 38

if {${name} ne ${subport}} {

    default_variants    +openmp

    variant openmp description "enable OpenMP parallel acceleration" {
        # Pick a compiler that supports openmp
        compiler.openmp_version 2.5
    }

    if {[variant_isset openmp]} {
        require_active_variants libsharp openmp
        require_active_variants healpix-cxx openmp
    } else {
        require_active_variants libsharp "" openmp
        require_active_variants healpix-cxx "" openmp
    }

    depends_build       port:pkgconfig \
                        port:py${python.version}-cython \
                        port:py${python.version}-pytest-runner \
                        port:py${python.version}-setuptools

    depends_lib-append  port:cfitsio \
                        port:py${python.version}-numpy \
                        port:py${python.version}-astropy \
                        port:py${python.version}-matplotlib \
                        port:py${python.version}-six \
                        port:healpix-cxx \
                        port:libsharp

    post-extract {
        # Regenerate Cython files
        file delete     ${worksrcpath}/healpy/src/_pixelfunc.cpp \
                        ${worksrcpath}/healpy/src/_query_disc.cpp \
                        ${worksrcpath}/healpy/src/_sphtools.cpp
    }

    livecheck.type      none
}
