# -*- coding: utf-8; mode: tcl; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- vim:fenc=utf-8:et:sw=4:ts=4:sts=4

PortSystem          1.0
PortGroup           octave 1.0

octave.setup        gitlab gnu-octave octave-pythonic 0.1.3 v
octave.module       pythonic
revision            2
license             GPL-3+
maintainers         {mps @Schamschula} openmaintainer
description         Pythonic is a package that provides a Python native calling \
                    interface for GNU Octave.
long_description    {*}${description}

checksums           rmd160  2e76ff1dd0ac906e1bd755f96826770687cfab9b \
                    sha256  c9b03a3bbf86546d5e3bdd88c30ceec0e637a504eafdba38f16a08a577415242 \
                    size    70788

variant python39 conflicts python310 python311 python312 python313 description {Use Python 3.9} {}
variant python310 conflicts python39 python311 python312 python313 description {Use Python 3.10} {}
variant python311 conflicts python39 python310 python312 python313 description {Use Python 3.11} {}
variant python312 conflicts python39 python310 python311 python313 description {Use Python 3.12} {}
variant python313 conflicts python39 python310 python311 python312 description {Use Python 3.13} {}

if {![variant_isset python39] && ![variant_isset python310]
        && ![variant_isset python311] && ![variant_isset python312]} {
    default_variants +python313
}

foreach pv {313 312 311 310 39 38} {
    if {[variant_isset python${pv}]} {
        depends_lib-append \
                    port:python${pv}
        set python.branch \
                    [string index ${pv} 0].[string range ${pv} 1 end]
        break
    }
}

post-patch {
    reinplace "s,= 3,= ${python.branch}," ${worksrcpath}/src/Makefile
}