PortSystem    1.0
PortGroup     python 1.0

name          bzr
version       2.6.0
revision      1
set branch    [join [lrange [split ${version} .] 0 1] .]
categories    devel python
platforms     darwin
license       GPL-2+
maintainers   {raimue @raimue}

description   The next-generation distributed version control system
long_description  Bazaar is an open source distributed version control \
    system that is powerful, friendly, and scalable. It manages trees of \
    files and subdirectories, In particular, it records revisions of trees, \
    representing their state at a particular point in time, and information \
    about those revisions and their relationships. Recording and retrieving \
    tree revisions is useful in several ways if you are writing software or \
    documents or doing similar creative work.

homepage      http://bazaar-vcs.org/
master_sites  https://launchpad.net/${name}/${branch}/${version}/+download/

checksums     md5     28c86653d0df10d202c6b842deb0ea35\
              rmd160  794dbc585fd1acc711b59016d0b2c3dfe97927d7 \
              sha256  0994797182eb828867eee81cccc79480bd2946c99304266bc427b902cf91dab0

python.default_version  27

patchfiles    patch-setup.py.diff \
              patch-lazy-regex.diff

depends_lib-append  port:py${python.version}-paramiko \
                    port:py${python.version}-crypto \
                    port:py${python.version}-curl \
                    port:py${python.version}-docutils \
                    port:py${python.version}-pyrex

test.run      yes
test.cmd      make
test.target   check

python.link_binaries no

post-destroot {
    ln -s ${python.prefix}/bin/bzr ${destroot}${prefix}/bin/
    ln -s ${python.prefix}/share/man/man1/bzr.1 \
        ${destroot}${prefix}/share/man/man1
    xinstall -m 644 -W ${worksrcpath} INSTALL NEWS README TODO \
        ${destroot}${prefix}/share/doc/${name}
}

variant bash_completion {
    depends_run-append  path:etc/bash_completion:bash-completion

    post-destroot {
        xinstall -d ${destroot}${prefix}/share/bash-completion/completions
        xinstall -m 644 ${worksrcpath}/contrib/bash/bzr \
            ${destroot}${prefix}/share/bash-completion/completions
    }
}

livecheck.type      regex
livecheck.url       https://launchpad.net/bzr/+download
livecheck.regex     ${name}-(\\d+(?:\\.\\d+)*)${extract.suffix}