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

distname            git_cola-${version}

checksums           rmd160  140645fdfa86df629bb3961895bf1ce2b0839d95 \
                    sha256  a5bb100a85fa32641da95150b7ec2076d6fa892f2813b91c5815f84bd17bd219 \
                    size    1343036

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

python.default_version 313

patchfiles          patch-pyqt-version.diff

variant qt5 conflicts qt6 description {Build with Qt 5} {
    post-patch {
        reinplace -W ${worksrcpath} -E "s/@@pyqt@@/pyqt5/" cola/app.py
    }

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

variant qt6 conflicts qt5 description {Build with Qt 6} {
    post-patch {
        reinplace -W ${worksrcpath} -E "s/@@pyqt@@/pyqt6/" cola/app.py
    }

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

if {${os.platform} eq "darwin" && ${os.major} < 18} {
    default_variants +qt5
} else {
    if {![variant_isset qt5]} {
        default_variants +qt6
    }
}



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

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

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
"
