# -*- 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
PortGroup           github 1.0

# Get pypi master_sites before github.setup changes it.
name                py-xdis
set pypi_sites      ${master_sites}

github.setup        rocky python-xdis 6.3.0
revision            0
checksums           rmd160  4e8a146280c492a468d94d22f93b9b5bad0d4126 \
                    sha256  e78e3e7a0e2d31ac64c084afc782a0a233da06ac05002c42a0e17000ac51dcaa \
                    size    795994

supported_archs     noarch
platforms           {darwin any}
license             GPL-2
maintainers         {khindenburg @kurthindenburg} openmaintainer

description         Python cross-version byte-code disassembler and marshal routines
long_description \
    The Python `dis` module allows you to disassemble bytecode from the same \
    version of Python that you are running on. \
    This package can "marshal load" Python \
    bytecodes from different versions of Python. The command-line routine \
    *pydisasm* will show disassembly output using the most modern Python \
    disassembly conventions in a variety of user-specified formats.  Some \
    of these formats like ``extended`` and ``extended-format`` are the most \
    advanced of any Python disassembler.

python.versions     310 311 312 313 314

if {${name} ne ${subport}} {
    worksrcdir              xdis-${version}
    if {${python.version} == 310} {
        checksums           rmd160  0c4b84a0306dbdd5775888a6e7fef1ed92badec7 \
                            sha256  cb9c00bc3d0ceb5504f9d2ec5666d34b6498c0193f314d4f3daef2d7187c755e \
                            size    812651

        github.tarball_from releases
        distname            xdis_36-${version}
    } else {
        master_sites        {*}${pypi_sites}
        distname            ${worksrcdir}
    }

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

    post-patch {
        reinplace "s|PYTHON ?= python|PYTHON ?= ${python.bin}|g" ${worksrcpath}/test/Makefile
    }

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

    test.run        yes
    python.test_framework
    test.dir        ${build.dir}/test
    test.cmd        make
    test.target     check-full
}
