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

PortSystem          1.0
PortGroup           python 1.0

name                py-lxml
version             5.1.1
revision            0

categories-append   devel
license             BSD
maintainers         {petr @petrrr} openmaintainer

description         Powerful and Pythonic XML processing library
long_description    lxml is a Pythonic binding for the libxml2 and \
                    libxslt libraries.  It is unique in that it \
                    combines the speed and feature completeness of \
                    these libraries with the simplicity of a native \
                    Python API, mostly compatible but superior to \
                    the well-known ElementTree API.

homepage            https://lxml.de/

checksums           rmd160  75d83693fe901f290e3ce6ad6db44ebf4546175b \
                    sha256  42a8aa957e98bd8b884a8142175ec24ce4ef0a57760e8879f193bfe64b757ca9 \
                    size    3838907

python.versions     27 35 36 37 38 39 310 311 312

if {${name} ne ${subport}} {
    if {${python.version} < 36} {
        version     5.0.2
        revision    0
        checksums   rmd160  edd377fe2e214c69db4e468583ac507cf71853a7 \
                    sha256  6399703c40ba53e2c3b72fdb56cb908d2b83c08082ecf17de839b27e68d1e598 \
                    size    3862433

        depends_build-append \
                    port:py${python.version}-setuptools
    }

    depends_lib-append \
                    port:zlib \
                    port:libxml2 \
                    port:libxslt

    # https://trac.macports.org/ticket/56666
    patchfiles-append   patch-setupinfo-remove-xcrun-call.diff

    # https://trac.macports.org/ticket/69386
    if {[string match {*gcc-[34].*} ${configure.compiler}]} {
        python.add_cflags   yes
        configure.cflags    -std=gnu99
    }

    test.run        yes
    python.test_framework
    test.cmd        ${python.bin} src/lxml/tests/selftest.py
}
