# -*- 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-gnureadline
version             8.2.13
license             GPL-3+ PSF

python.versions     27 310 311 312 313 314

maintainers         {stromnov @stromnov} openmaintainer

description         Python readline extension.
long_description    {*}${description}

homepage            https://github.com/ludwigschwardt/python-gnureadline

checksums           md5 c3a6b5751fa063d5e75dea0b23786118 \
                    rmd160 e3f88f251fc08877818334f4928bd999ea8233d4 \
                    sha256 c9b9e1e7ba99a80bb50c12027d6ce692574f77a65bf57bc97041cf81c0f49bd1 \
                    size   3224991

if {${name} ne ${subport}} {
    if {${python.version} == 27} {
        depends_build-append \
                    port:py${python.version}-setuptools
    }

    depends_lib-append  port:ncurses

    patchfiles          build.sh.patch \
                        setup.py.patch

    post-patch {
        reinplace "s|__OPTFLAGS__|${configure.optflags}|" ${worksrcpath}/rl/build.sh
    }

    post-destroot {
        copy -force ${filespath}/readline.pth ${filespath}/readline_path.py \
            ${destroot}${python.pkgd}
        reinplace "s|__LIBDIR__|${python.libdir}|" ${destroot}${python.pkgd}/readline_path.py
    }
}
