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

name                py-astropy
version             7.1.0
revision            1
# Why is this?
platforms           {darwin >= 10}
maintainers         {mps @Schamschula} openmaintainer
categories-append   science
description         A Community Python Library for Astronomy
long_description    The Astropy project is a common effort to develop \
                    a single core package for Astronomy.
license             BSD
homepage            https://www.astropy.org
checksums           rmd160  df44c796e413a45a5ca7c843e282b4ef03dfb268 \
                    sha256  c8f254322295b1b8cf24303d6f155bf7efdb6c1282882b966ce3040eff8c53c5 \
                    size    6976116

python.versions     310 311 312 313 314

# see https://trac.macports.org/ticket/48941
compiler.blacklist  {*llvm-gcc42}
compiler.blacklist-append \
                    *gcc-4.* {clang < 421}

if {${subport} ne ${name}} {
    if {${python.version} <= 310} {
        version     6.1.6
        revision    2

        checksums   rmd160  82c6865426bb786aa9d753228f01bf6362f4ecaf \
                    sha256  63e153747de7892138860925f0395de66d0bd036c69837f68bf93aeadaac6847 \
                    size    7062175
    }

    depends_build-append \
                    path:bin/pkg-config:pkgconfig \
                    port:py${python.version}-cython \
                    port:py${python.version}-extension-helpers \
                    port:py${python.version}-jinja2 \
                    port:py${python.version}-setuptools_scm \
                    port:py${python.version}-toml

    depends_lib-append  \
                    port:cfitsio \
                    port:erfa \
                    port:expat \
                    port:py${python.version}-astropy-iers-data \
                    port:py${python.version}-colorlog \
                    port:py${python.version}-h5py \
                    port:py${python.version}-matplotlib \
                    port:py${python.version}-numpy \
                    port:py${python.version}-packaging \
                    port:py${python.version}-pandas \
                    port:py${python.version}-pyerfa \
                    port:py${python.version}-pythran \
                    port:py${python.version}-scipy \
                    port:py${python.version}-yaml \
                    port:wcslib

    # https://github.com/astropy/astropy/issues/18650
    if {${configure.build_arch} in [list ppc ppc64]} {
        post-patch {
            reinplace "s|define BYTEORDER 1234|define BYTEORDER 4321|" \
                    ${worksrcpath}/astropy/utils/xml/src/expat_config.h
        }
    }

    variant all description "Full install" {
        depends_lib-append \
                    port:pre-commit \
                    port:py${python.version}-asdf-astropy \
                    port:py${python.version}-beautifulsoup4 \
                    port:py${python.version}-bleach \
                    port:py${python.version}-bottleneck \
                    port:py${python.version}-certifi \
                    port:py${python.version}-dask \
                    port:py${python.version}-fsspec \
                    port:py${python.version}-html5lib \
                    port:py${python.version}-ipython \
                    port:py${python.version}-jplephem \
                    port:py${python.version}-mpmath \
                    port:py${python.version}-pyarrow \
                    port:py${python.version}-pytest \
                    port:py${python.version}-s3fs \
                    port:py${python.version}-sortedcontainers \
                    port:py${python.version}-typing_extensions \
                    port:py${python.version}-tz
    }

    dist_subdir     ${name}/${version}
    distname        astropy-${version}
}
