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

github.setup        saltstack libnacl 1.7.1 v
# Change github.tarball_from to 'releases' or 'archive' next update
github.tarball_from tarball
revision            1
name                py-libnacl

categories-append   net
supported_archs     noarch
platforms           {darwin any}
license             Apache-2
maintainers         nomaintainer

description         Python binding for libsodium
long_description    Libnacl is a Python binding for the libsodium NaCl crypto \
                    library.

checksums           rmd160  76403cf9580ff87bd364dc5e76b3a4d20568233c \
                    sha256  d31630a7ce5ebb760fb64e921113745b754e4055db092b37255bd0c9f9b81c8d \
                    size    43249

python.versions     38

if {${name} ne ${subport}} {
    depends_lib-append  \
                    port:libsodium \
                    port:py${python.version}-six

    patchfiles      libsodium-path.patch
    post-patch {
        reinplace "s|__PREFIX__|${prefix}|" ${worksrcpath}/libnacl/__init__.py
    }

    test.run        yes
    python.test_framework
    test.cmd        ${python.bin} tests/runtests.py

    post-destroot {
        set docdir ${prefix}/share/doc/${subport}
        xinstall -d ${destroot}${docdir}
        xinstall -m 0644 -W ${worksrcpath} AUTHORS LICENSE \
            README.rst ${destroot}${docdir}
    }
}