# -*- 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.16.1
categories-append       science
license                 GPL-2
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}.

homepage                https://pypi.python.org/pypi/${python.rootname}/

checksums               rmd160  4608c521ffd99d87bf649679aa66d955ff02e5be \
                        sha256      6d691b0a77fdf699672de09d39d82a640cfcc8ca03ae55022fb71e6edda69d2f \
                        size    4351539

python.versions         39 310 312

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}-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
    }
}
