# -*- 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             6.1.0
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           md5 31d8b15cdee087ef63b3f2dde600af8d \
                    rmd160 01a1a59a8bce30c46cda4343998ed01965d90bb5 \
                    sha256 bfd57d8008c4965709a919c3e9a98f76c2c7cb319086b3d26858250620023b13 \
                    size   4197006

python.versions     27 37 310 311 312 313 314

if {${name} ne ${subport}} {
    if {${python.version} == 27} {
        version     5.0.2
        revision    0
        checksums   rmd160  edd377fe2e214c69db4e468583ac507cf71853a7 \
                    sha256  6399703c40ba53e2c3b72fdb56cb908d2b83c08082ecf17de839b27e68d1e598 \
                    size    3862433
    } elseif {${python.version} == 37} {
        version     5.4.0
        revision    0
        checksums   rmd160  388615fe1ee020bdbc0fc6556a47a94843578e9d \
                    sha256  d12832e1dbea4be280b22fd0ea7c9b87f0d8fc51ba06e92dc62d52f804f78ebd \
                    size    3679479
    }

    depends_build-append \
                    port:py${python.version}-cython \
                    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
    # As of 5.1.1, it does not build with gcc-4.2 anymore,
    # even if pragmas are patched out:
    # etree.h: error: wrong number of arguments specified for ‘__deprecated__’ attribute
    # Old Xcode clang of 10.6 also does not build it.
    compiler.blacklist-append \
                    {*gcc-[34].*} {clang < 421}

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