# -*- 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.25.1
revision            0

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  b6b02ecb328cc734340bfe89e242d487f1b4f4b7 \
                    sha256  9eaf90267c7e83e225af89fea65c370afbf65f458220d3946a9e3049e1eca491 \
                    size    406157

python.versions     27 39 310 311 312 313

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

    if {${python.version} == 39} {
        depends_lib-append \
                    port:py${python.version}-importlib-metadata
    }

    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 ${destroot}${docdir}

    }
}
