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

name                py-spaCy
version             3.5.0
revision            0

checksums           rmd160  674c7cde6db2aa9affdb8bc0709205b67333c481 \
                    sha256  fe20127012992778804d93f75ce9370d588573072639c3832cec38f54bf7e4a5 \
                    size    1233771

platforms           darwin
supported_archs     arm64 x86_64

license             MIT

maintainers         nomaintainer

description         Industrial-strength Natural Language Processing (NLP) with Python and Cython
long_description    {*}${description}

homepage            https://spacy.io

python.rootname     spacy
python.versions     39 310

if {${name} ne ${subport}} {
    mpi.setup       -gcc44 -gcc45 -clang33 -clang34 -clang37 -gfortran -g95

    compiler.cxx_standard 2014
    compiler.blacklist-append *gcc* {clang < 900} {macports-clang-3.[0-9]} macports-clang-4.0

    depends_build-append \
                    port:cctools \
                    port:py${python.version}-setuptools \
                    port:py${python.version}-wheel

    depends_lib-append \
                    port:py${python.version}-blis \
                    port:py${python.version}-cymem \
                    port:py${python.version}-catalogue \
                    port:py${python.version}-confection \
                    port:py${python.version}-cython \
                    port:py${python.version}-jsonschema \
                    port:py${python.version}-langcodes \
                    port:py${python.version}-murmurhash \
                    port:py${python.version}-numpy \
                    port:py${python.version}-packaging \
                    port:py${python.version}-plac \
                    port:py${python.version}-preshed \
                    port:py${python.version}-pydantic \
                    port:py${python.version}-requests \
                    port:py${python.version}-srsly \
                    port:py${python.version}-thinc \
                    port:py${python.version}-typing_extensions \
                    port:py${python.version}-typer \
                    port:py${python.version}-tqdm \
                    port:py${python.version}-wasabi

    # spaCy uses pip to download models.
    depends_lib-append \
                    port:py${python.version}-pip

    depends_test-append \
                    port:py${python.version}-flake8 \
                    port:py${python.version}-mock \
                    port:py${python.version}-pytest

    post-patch {
        set PythonVersionWithDot [join [split ${python.version} ""] "."]
        foreach f [ exec find ${worksrcpath}/ -name "*.py"] {
            reinplace -q "s|python \-m|python${PythonVersionWithDot} \-m|g" ${f}
            reinplace -q "s|env python|env python${PythonVersionWithDot}|g" ${f}
        }
    }

    build.target-replace build build_ext
    build.args-append --inplace
}
