# -*- 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                zeroinstall-injector
version             1.7
revision            6

platforms           {darwin any} freebsd linux
supported_archs     noarch
categories          sysutils
license             LGPL
maintainers         nomaintainer

description         The Zero Install Injector (0launch)
long_description    The Zero Install Injector makes it easy for users to install \
                    software without needing root privileges. It takes the URL of \
                    a program and runs it (downloading it first if necessary). Any \
                    dependencies of the program are fetched in the same way. The \
                    user controls which version of the program and its dependencies \
                    to use.

homepage            https://0install.net

master_sites        sourceforge
master_sites.mirror_subdir zero-install
use_bzip2           yes

checksums           rmd160  46ac65794f57146afed45582d4ff43f05ffe5bb9 \
                    sha256  4472d5964e14a16cec5a27bbfc169340b7e45781ec2429abeaa4726674987c2c \
                    size    375817

python.default_version 27

depends_lib-append  path:bin/gpg:gnupg2 \
                    port:py${python.version}-pygtk

depends_run-append  bin:sudo:sudo

patchfiles-append   patch-tests_testall.py.diff

post-patch   {
    reinplace "s|'man/man1'|'share/man/man1'|" ${worksrcpath}/setup.py
    reinplace "s|local_0launch,|'${python.bin}', local_0launch,|" ${worksrcpath}/tests/testrun.py
    reinplace "s|/usr/bin/env python|${python.bin}|" ${worksrcpath}/zeroinstall/0launch-gui/0launch-gui
}

test.run            yes
test.cmd            ${python.bin}
test.dir            ${worksrcpath}/tests
test.target         testall.py

livecheck.type      regex
livecheck.url       https://sourceforge.net/projects/zero-install/files/injector/
livecheck.regex     /injector/(\\d+(?:\\.\\d+)*)/