# -*- 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                git-cola
version             4.1.0
revision            0

supported_archs     noarch
platforms           {darwin any}
categories-prepend  devel
maintainers         {raimue @raimue} \
                    openmaintainer
license             GPL-2+

description         The highly caffeinated Git GUI
long_description    git-cola is a powerful Git GUI with a slick and \
                    intuitive user interface.

checksums           rmd160  effbd5a8d4ce0ddafdbd1fe1604ec88f58d35612 \
                    sha256  d77ba2eb1d1240f47cc44f5fcb9230cc65681834e7e27edf17c5ada462d3fb07 \
                    size    1140358

homepage            https://git-cola.github.io/

python.default_version 311
python.pep517       yes

patchfiles          patch-pyqt-version.diff

# now default to Qt5, Qt6 and/or PySide2 are other options, for which one could add
# variants if deemed useful
post-patch {
    reinplace -W ${worksrcpath} -E "s/@@pyqt@@/pyqt5/" cola/app.py
}

depends_build-append \
                    port:py${python.version}-setuptools_scm \
                    port:py${python.version}-toml

depends_lib-append  port:git \
                    port:py${python.version}-pyqt5 \
                    port:py${python.version}-qtpy

post-destroot {
    xinstall -d ${destroot}${prefix}/share/bash-completion/completions
    xinstall -m 644 ${worksrcpath}/contrib/git-cola-completion.bash ${destroot}${prefix}/share/bash-completion/completions/${name}
}

notes "\
    If you want to use bash-completion for git-cola, you have to source the\
    completion files from your ~/.bashrc as it extends the git command\
    completion and cannot be loaded automatically:

      source ${prefix}/share/bash-completion/completions/git
      source ${prefix}/share/bash-completion/completions/git-cola
"