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

name                git-remote-hg
github.setup        mnauw git-remote-hg 1.0.3.2 v
# Change github.tarball_from to 'releases' or 'archive' next update
github.tarball_from tarball
revision            4
categories          devel python
maintainers         {landonf @landonf} openmaintainer
license             GPL-2
description         Transparent bidirectional bridge between Git and Mercurial for Git
long_description    {*}${description}.

checksums           rmd160  3c3c5dc2975cda2bf8e44752c2efd312f5b9342c \
                    sha256  4c2f91c3c1a83b3a4a6162b56e97872388f4b17fc9d2a6aedf2cd613256767f6 \
                    size    66640

python.default_version 313

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

post-patch {
    reinplace "1 s|/usr/bin/env python.*|${python.bin}|g" \
        ${worksrcpath}/git-remote-hg

    reinplace -E "s|^(prefix\[\[:space:\]\].*.?=).*|\\1 ${prefix}|g" \
        ${worksrcpath}/Makefile
}

post-build {
    system -W "${worksrcpath}" "env PYTHON=${python.bin} make"
}

post-destroot {
    system -W "${worksrcpath}" \
        "make install-doc DESTDIR=${destroot} PREFIX=${prefix}"
}

test.run            yes
