# -*- 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
PortGroup           compiler_blacklist_versions 1.0

name                py-spaCy
version             3.0.5
revision            0

checksums           rmd160  d5928670b303910d37c2baa76a84f81c750831b9 \
                    sha256  9f7a09fbad53aac2a3cb7696a902de62b94575a15d249dd5e26a98049328060e \
                    size    7041245

platforms           darwin
supported_archs     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     36 37 38 39

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}-cython \
        port:py${python.version}-jsonschema \
        port:py${python.version}-murmurhash \
        port:py${python.version}-numpy \
        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}-tqdm \
        port:py${python.version}-wasabi  

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

    # spaCy uses pip to download models.
    depends_run-append \
        port:py${python.version}-pip
    
    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

    livecheck.type none 

}
