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

name                py-sphinx
version             8.2.3
categories-append   textproc devel
license             BSD
maintainers         {jmr @jmroot} openmaintainer
description         Python documentation generator
long_description \
    Sphinx is a tool that makes it easy to create intelligent and beautiful \
    documentation for Python projects (or other documents consisting of \
    multiple reStructuredText sources), written by Georg Brandl. It was \
    originally created to translate the new Python documentation, but has now \
    been cleaned up in the hope that it will be useful to many other projects.

supported_archs     noarch
platforms           {darwin any}

homepage            https://www.sphinx-doc.org/

checksums           md5 eec3083f144d88cf65ad3da422fc7e66 \
                    rmd160 55c46da7af60eb3c74f08baa597c176be88452ab \
                    sha256 398ad29dee7f63a75888314e9424d40f52ce5a6a87ae88e7071e80af296ec348

python.versions     27 36 37 38 39 310 311 312 313 314
python.pep517_backend   flit

if {$subport ne $name} {
    depends_lib     port:py${python.version}-docutils
    depends_run     port:py${python.version}-alabaster \
                    port:py${python.version}-babel \
                    port:py${python.version}-imagesize \
                    port:py${python.version}-jinja2 \
                    port:py${python.version}-packaging \
                    port:py${python.version}-pygments \
                    port:py${python.version}-requests \
                    port:py${python.version}-snowballstemmer \
                    port:sphinx_select

    if {${python.version} <= 37} {
        # case of filename changed as of 7.1.0
        python.rootname Sphinx
    }
    if {${python.version} >= 36 && ${python.version} <= 39} {
        depends_lib-append  port:py${python.version}-importlib-metadata
    }
    if {${python.version} >= 39 && ${python.version} <= 310} {
        depends_run-append  port:py${python.version}-tomli
    }
    if {${python.version} >= 310} {
        patchfiles-append   pyproject.toml.patch
    }
    if {${python.version} >= 311} {
        depends_run-append  port:py${python.version}-roman_numerals_py
    }
    if {${python.version} == 310} {
        version     8.1.3
        revision    0
        checksums   md5 845210d4c36be0dac08ec2ce2411a194 \
                    rmd160 bbe16c58fe5146f706929bf8330f29d3d039a26d \
                    sha256 43c1911eecb0d3e161ad78611bc905d1ad0e523e4ddc202a58a821773dc4c927
    } elseif {${python.version} == 39} {
        version     7.4.7
        revision    0
        checksums   md5 6d2fb7fc80f39a8696df9493d62c576f \
                    rmd160 dfa45ff1aba5e9446770fd9c7b4e047d64907b89 \
                    sha256 242f92a7ea7e6c5b406fdc2615413890ba9f699114a9c09192d7dfead2ee9cfe
        patchfiles  pyproject.toml-7.4.7.patch
    } elseif {${python.version} == 38} {
        version     7.1.2
        revision    0
        checksums   md5 78c6fc2b8344e2b13ecad7ef2285b7d8 \
                    rmd160 dbd40a94b4f2cc230c49c1e16609b590217a8f3a \
                    sha256 780f4d32f1d7d1126576e0e5ecc19dc32ab76cd24e950228dcf7b1f6d3d9e22f
        patchfiles  pyproject.toml-7.1.2.patch
    } elseif {${python.version} in {36 37}} {
        version     5.3.0
        revision    0
        checksums   md5 b752f7b0177865a36cbcdcef4ac80cd4 \
                    rmd160 b9d212a39f7dc632b595d92f5cd0e8c48213b571 \
                    sha256 51026de0a9ff9fc13c05d74913ad66047e104f56a129ff73e174eb5c3ee794b5
        patchfiles  pyproject.toml-5.3.0.patch
        python.pep517   yes
    }
    if {${python.version} == 27} {
        version     1.8.5
        revision    0
        checksums   md5 554f7a4e752f48b2601e5ef5ab463346 \
                    rmd160 a7a38523976288c13a8a7e5bf4a81367db9af462 \
                    sha256 c7658aab75c920288a8cf6f09f244c6cfdae30d82d803ac1634d9f223a80ca08

        depends_lib-append  port:py${python.version}-setuptools
        depends_run-append  port:py${python.version}-six \
                            port:py${python.version}-sphinxcontrib-websupport \
                            port:py${python.version}-typing
    } else {
        depends_run-append  port:py${python.version}-sphinxcontrib-applehelp \
                            port:py${python.version}-sphinxcontrib-devhelp \
                            port:py${python.version}-sphinxcontrib-htmlhelp \
                            port:py${python.version}-sphinxcontrib-jsmath \
                            port:py${python.version}-sphinxcontrib-serializinghtml \
                            port:py${python.version}-sphinxcontrib-qthelp
    }

    select.group    sphinx
    select.file     ${filespath}/py${python.version}-sphinx

    notes "
To make the Python ${python.branch} version of Sphinx the one that is run when\
you execute the commands without a version suffix, e.g. 'sphinx-build', run:

port select --set ${select.group} [file tail ${select.file}]
"

    livecheck.type  none
}
