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

github.setup        tensorflow probability 0.12.1 v
# Change github.tarball_from to 'releases' or 'archive' next update
github.tarball_from tarball
revision            0
name                py-${github.author}-${github.project}

license             Apache-2
maintainers         nomaintainer

description         Probabilistic modeling and statistical inference \
                    in TensorFlow

long_description    TensorFlow Probability is a library for probabilistic \
                    reasoning and statistical analysis in TensorFlow. As \
                    part of the TensorFlow ecosystem, TensorFlow Probability \
                    provides integration of probabilistic methods with deep \
                    networks, gradient-based inference via automatic \
                    differentiation, and scalability to large datasets \
                    and models via hardware acceleration and distributed \
                    computation.

homepage            https://github.com/tensorflow/probability

checksums           rmd160  c7d5eab256a322d0869b5d921e1ee743a9e16d71 \
                    sha256  4e1b1925e809adff3184e1596d84880537b90074bc0f9d6fdc242e6f55cd1f22 \
                    size    35499157

python.versions     39

if {${name} ne ${subport}} {
    PortGroup       bazel 1.0

    bazel.version   3.7

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

    depends_run-append \
                    port:py${python.version}-absl \
                    port:py${python.version}-cloudpickle \
                    port:py${python.version}-decorator \
                    port:py${python.version}-dm-tree \
                    port:py${python.version}-gast \
                    port:py${python.version}-numpy \
                    port:py${python.version}-six

    depends_test-append \
                    port:py${python.version}-hypothesis


    # Use correct python
    bazel.python_version ${python.branch}

    bazel.build_target \
                    :pip_pkg
    bazel.post_build_cmd \
                    "PATH=${workpath}/bin:$env(PATH)" ./bazel-bin/pip_pkg ${workpath}

    destroot.cmd  pip-${python.branch}
    destroot.args           \
        --ignore-installed  \
        --no-cache-dir      \
        --no-dependencies   \
        --root ${destroot}  \
        ${workpath}/tfp_nightly-${version}-*.whl
    destroot.post_args

    test.run        yes

    post-destroot {
        set docdir ${prefix}/share/doc/${subport}
        xinstall -d ${destroot}${docdir}
        xinstall -m 0644 -W ${worksrcpath} LICENSE README.md \
            ${destroot}${docdir}
    }
}