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

name                py-torchtext
version             0.13.1
revision            0
github.setup        pytorch text ${version} v
# Change github.tarball_from to 'releases' or 'archive' next update
github.tarball_from tarball
fetch.type          git

supported_archs     arm64 x86_64

license             BSD

maintainers         nomaintainer

description         PyTorch data loaders and abstractions for text and NLP
long_description    {*}${description}

homepage            https://github.com/pytorch/text

github.livecheck.regex  {([0-9.]+)}

# Supported python versions
python.versions     39 310

if {${os.platform} eq "darwin" && ${os.major} <= 15} {
    known_fail yes
    pre-fetch {
        ui_error "$subport is not supported on OS X 10.11 and older."
        return -code error "unsupported platform"
    }
}

if {${name} ne ${subport}} {
    compiler.cxx_standard  2014

    depends_build-append \
        path:bin/cmake:cmake \
        port:ninja \
        port:py${python.version}-setuptools

    depends_lib-append \
        port:py${python.version}-nltk \
        port:py${python.version}-spaCy \
        port:py${python.version}-spaCy-models \
        port:py${python.version}-pytorch \
        port:zmq

    post-fetch {
        system -W ${worksrcpath} "git submodule update --init --recursive"
    }

    build.cmd    "${python.bin} setup.py"
    destroot.cmd "${python.bin} setup.py install"
}
