# -*- 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        sphinx-contrib sphinxcontrib-versioning 2.2.1 v
revision            1
name                py-${github.project}

categories-append   devel
license             MIT
maintainers         nomaintainer
platforms           darwin

description         Sphinx extension that allows building versioned \
                    docs for self-hosting.
long_description    ${description}

checksums           rmd160  d8968af5f62fa35381c48979642092aefc248403 \
                    sha256  7c38140e71ae2fc63b0668b7ec5671c7dbb4b41a1ac4ffe88acca980b960b87c \
                    size    2378524

python.versions     37 38

# fix for newer versions of Sphinx and pytest
patchfiles          patch-sphinxcontrib_versioning_sphinx_.py.diff \
                    patch-tests_conftest.py.diff \
                    patch-tests_test_main_push_scenarios.py.diff

if {${name} ne ${subport}} {
    depends_lib-append \
                    port:py${python.version}-click \
                    port:py${python.version}-colorclass \
                    port:py${python.version}-setuptools \
                    port:py${python.version}-sphinx

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

    # FIXME: even with the current upstream patches applied, the tests do not pass.
    test.run        yes
    test.cmd        pytest-${python.branch}
    test.target
    test.env        PYTHONPATH=${worksrcpath}/build/lib

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

    livecheck.type  none
}
