# -*- 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                py-uncompyle6
version             3.9.3
revision            0

categories-append   devel
supported_archs     noarch
platforms           {darwin any}
license             GPL-3+
maintainers         {reneeotten @reneeotten} openmaintainer

description         Python cross-version byte-code decompiler
long_description    {*}${description}

homepage            https://github.com/rocky/python-uncompyle6/

checksums           rmd160  07e2516c56b3cb9262979561b614145d4fb15da5 \
                    sha256  78b764d4c843b0455fb39db6deb421a48d5d3ebb846537ba6444afe107c4ebc1 \
                    size    2475497

python.versions     310 311 312 313

if {${name} ne ${subport}} {
    post-patch {
        reinplace "s|PYTHON ?= python|PYTHON ?= ${python.bin}|g" ${worksrcpath}/Makefile \
            ${worksrcpath}/test/Makefile ${worksrcpath}/pytest/Makefile
        reinplace "s|py.test|py.test-${python.branch}|g" ${worksrcpath}/pytest/Makefile
    }

    depends_lib-append \
                    port:py${python.version}-click \
                    port:py${python.version}-spark_parser \
                    port:py${python.version}-xdis

    depends_test-append \
                    port:py${python.version}-six \
                    port:py${python.version}-pytest

    test.run        yes
    python.test_framework
    test.cmd        make
    test.target     check-${python.branch}
    test.env        COMPILE=--compile \
                    PYTHONPATH=${worksrcpath}/build/lib

    post-destroot {
        set docdir ${prefix}/share/doc/${subport}
        xinstall -d ${destroot}${docdir}
        xinstall -m 0644 -W ${worksrcpath} COPYING ChangeLog HISTORY.md \
           README README.rst ${destroot}${docdir}
    }
}
