# -*- 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                buku
version             5.0
revision            0
checksums           rmd160  8881149f3fca57e7eab7fbb4296e1e60f577edc0 \
                    sha256  895a86b099adfe420c1925f333ce6cb00b851a6f11bcc7e42fb125fa81cae8b2 \
                    size    287044

description         A command-line bookmark manager
long_description    buku is a powerful bookmark manager written in \
                    Python3 and SQLite3. buku can auto-import \
                    bookmarks from your browser(s) or fetch the title \
                    and description of a bookmarked url from the web. \
                    You can use your favourite editor to compose and \
                    update bookmarks. With multiple search options, \
                    including regex and a deep scan mode (particularly \
                    for URLs), it can find any bookmark instantly. \
                    buku can look up the latest snapshot of a broken \
                    link on the Wayback Machine.  There's an Easter \
                    egg to revisit random forgotten bookmarks too! \
                    buku is too busy to track you: no hidden history, \
                    obsolete records, usage analytics or homing.

homepage            https://github.com/jarun/buku

categories-append   www
platforms           {darwin any}
supported_archs     noarch
maintainers         {acm.org:cardi @cardi} openmaintainer
license             GPL-3

python.default_version  313

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

depends_lib-append  port:py${python.version}-beautifulsoup4 \
                    port:py${python.version}-certifi \
                    port:py${python.version}-cryptography \
                    port:py${python.version}-html5lib \
                    port:py${python.version}-urllib3

post-extract {
    # build only buku by default
    reinplace "s|exclude=\\\['tests'\\\]|include=\\\['buku'\\\]|" ${worksrcpath}/setup.py
    reinplace "s|, 'bukuserver=bukuserver.server:cli'||" ${worksrcpath}/setup.py
}

pre-destroot {}

post-destroot {
    # install documentation
    xinstall -d -m 0755 ${destroot}${prefix}/share/doc/${name}
    xinstall -m 0644 -W ${worksrcpath} CHANGELOG LICENSE README.md ${destroot}${prefix}/share/doc/${name}

    # install man pages
    xinstall -d -m 0755 ${destroot}${prefix}/share/man/man1
    xinstall -m 0644 -W ${worksrcpath} buku.1 ${destroot}${prefix}/share/man/man1/

    # install shell completions (bash, fish, zsh)
    xinstall -d ${destroot}${prefix}/share/bash-completion/completions/
    xinstall -m 644 ${worksrcpath}/auto-completion/bash/buku-completion.bash ${destroot}${prefix}/share/bash-completion/completions/${name}
    xinstall -d ${destroot}${prefix}/share/fish/vendor_completions.d/
    xinstall -m 644 ${worksrcpath}/auto-completion/fish/buku.fish ${destroot}${prefix}/share/fish/vendor_completions.d/
    xinstall -d ${destroot}${prefix}/share/zsh/site-functions/
    xinstall -m 644 ${worksrcpath}/auto-completion/zsh/_buku ${destroot}${prefix}/share/zsh/site-functions/
}
