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

github.setup        google yapf 0.43.0 v
github.tarball_from archive
revision            0
name                py-yapf

categories-append   devel
supported_archs     noarch
platforms           {darwin any}
license             Apache-2
maintainers         {reneeotten @reneeotten} openmaintainer

description         A formatter for Python files
long_description    YAPF is based off of 'clang-format', developed by Daniel Jasper.

checksums           rmd160  c2c8b3811d53234cbfd0edb18c57570f2e789623 \
                    sha256  1d8ca9d7e1fc429c496e0a046e509e437d5ae766487b0394c45fc1fdf253b5d4 \
                    size    231930

python.versions     310 311 312 313 314

if {${subport} ne ${name}} {
    depends_lib-append \
                    port:py${python.version}-platformdirs

    if {${python.version} < 311} {
        depends_lib-append \
                    port:py${python.version}-tomli
    }

    depends_run-append \
                    port:yapf_select

    test.run        yes

    post-destroot {
        set docdir ${prefix}/share/doc/${subport}
        xinstall -d ${destroot}${docdir}
        xinstall -m 0644 -W ${worksrcpath} AUTHORS CHANGELOG.md \
            CONTRIBUTING.md CONTRIBUTORS HACKING.md \
            LICENSE README.md ${destroot}${docdir}
    }

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

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

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