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

github.setup        pytorch vision 0.9.1 v
revision            2
name                py-torchvision

license             BSD
maintainers         nomaintainer
platforms           darwin
supported_archs     x86_64

description         PyTorch datasets, transforms and models specific to \
                    computer vision

long_description    The torchvision package consists of popular \
                    datasets, model architectures, and common image \
                    transformations for computer vision.

checksums           rmd160  946000baedbc1cd14b7d8e59587d703449f2aa2c \
                    sha256  e836d7d7f256972f254b3a65099e25c2bdc76ccd39348fa0c46a083b51561b53 \
                    size    7219847

python.versions     37 38 39

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}} {
    depends_build-append \
                    port:py${python.version}-setuptools \
                    port:py${python.version}-wheel

    depends_lib-append \
                    port:py${python.version}-Pillow \
                    port:py${python.version}-pytorch

    compiler.cxx_standard 2014

    # https://github.com/pytorch/vision/blob/master/packaging/build_wheel.sh
    build.cmd       ${python.bin} setup.py
    build.target    bdist_wheel

    pre-test {
        test.env-append \
                    PYTHONPATH=[glob -nocomplain ${worksrcpath}/build/lib*]
    }

    test.run        yes
    test.cmd        py.test-${python.branch}

    livecheck.type  none
}
