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

homepage            https://www.sphinx-doc.org/
python.rootname     Sphinx

checksums           md5 ed63e60d798d212c1afdecf8acda690e \
                    rmd160 872e10aa5a8dd44f00a45fed7ebd5f9f8de32437 \
                    sha256 7bf8ca9637a4ee15af412d1a1d9689fec70523a68ca9bb9127c2f3eeb344e2e6

python.versions     27 35 36 37 38 39 310

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} > 35} {
        patchfiles-append   setup.py.patch
        python.pep517   yes
        if {${python.version} <= 39} {
            depends_lib-append  port:py${python.version}-importlib-metadata
        }
    } else {
        depends_lib-append  port:py${python.version}-setuptools
    }
    if {${python.version} == 35} {
        version     3.5.4
        revision    0
        checksums   md5 dd46088ebc01f6f721ee7618df680d68 \
                    rmd160 70102258335337eff3cc16526e84e9a95c625018 \
                    sha256 19010b7b9fa0dc7756a6e105b2aacd3a80f798af3c25c273be64d7beeb482cb1 \
                    size 5911093

        patch.pre_args      -p1
        # Source of patch: https://github.com/catap/sphinx/tree/docutils-1.8-v354
        patchfiles-append   docutils-0.18-v345.patch
    }
    if {${python.version} == 27} {
        version     1.8.5
        revision    0
        checksums   md5 554f7a4e752f48b2601e5ef5ab463346 \
                    rmd160 a7a38523976288c13a8a7e5bf4a81367db9af462 \
                    sha256 c7658aab75c920288a8cf6f09f244c6cfdae30d82d803ac1634d9f223a80ca08

        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
}
