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

name                py-pybtex
epoch               1
version             0.26.1

categories-append   textproc
platforms           {darwin any}
supported_archs     noarch
license             MIT
maintainers         nomaintainer

description         A BibTeX-compatible bibliography processor in Python.
long_description    Pybtex reads citation information from a file and \
                    produces a formatted bibliography.  BibTeX style files \
                    are supported.  Alternatively it is possible to write \
                    styles in Python.

homepage            https://pybtex.org/

checksums           rmd160  72222ea8926b2f4a6b240bb637f9669f258e4d98 \
                    sha256  2e5543bea424e60e9e42eef70bff597be48649d8f68ba061a7a092b2477d5464 \
                    size    692991

python.versions     27 310 311 312 313

python.pep517_backend   hatch

if {${name} ne ${subport}} {
    if {${python.version} == 27} {
        version     0.24.0
        revision    0
        checksums   rmd160  a735bc1a36c3e229a686d0a9c648620b954fbccc \
                    sha256  818eae35b61733e5c007c3fcd2cfb75ed1bc8b4173c1f70b56cc4c0802d34755 \
                    size    402879

        depends_lib-append \
                    port:py${python.version}-six \
                    port:py${python.version}-setuptools

        # make sure the "tests" directory is inside the pybtex directory so that it
        # doesn't get installed into ${python.pkgd}
        post-destroot   {
            file rename ${destroot}/${python.pkgd}/tests ${destroot}/${python.pkgd}/${python.rootname}/tests
        }
    }

    distname        pybtex-${version}

    depends_lib-append \
                    port:py${python.version}-latexcodec \
                    port:py${python.version}-yaml

    test.run        yes

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

    }
}
