# -*- Mode: Tcl; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- vim:et:sw=4:ts=4:sts=4
# $Id: Portfile 97042 2012-08-25 08:47:38Z jmr@macports.org $

PortSystem 1.0

name                    py-libxslt
epoch                   1
version                 1.1.26
categories              python textproc
license                 MIT
platforms               darwin
maintainers             sfiera openmaintainer
description             Python bindings for libxslt
long_description        ${description}

homepage                http://xmlsoft.org/XSLT/
master_sites            ftp://fr.rpmfind.net/pub/libxml/ \
                        ftp://gd.tuwien.ac.at/pub/libxml/ \
                        http://xmlsoft.org/sources/ \
                        ftp://xmlsoft.org/libxslt/
distname                libxslt-${version}
dist_subdir             libxslt
checksums               md5 e61d0364a30146aaa3001296f853b2b9 \
                        sha1 69f74df8228b504a87e2b257c2d5238281c65154 \
                        rmd160 fc7630352ae5772d25fc8132a373d477fb8d8d5f

foreach v {24 25 26 27} {
    subport py${v}-libxslt "
        set python.version $v
        set python.branch [join [split $v ""] .]
    "
}

if {$subport != $name} {
    depends_lib             port:libxslt \
                            port:py${python.version}-libxml2

    configure.python        ${prefix}/bin/python${python.branch}
    configure.args          --mandir=${prefix}/share/man \
                            --enable-static \
                            --with-libxml-prefix=${prefix} \
                            --with-python \
                            --without-crypto

    destroot.dir            ${worksrcpath}/python
    if {${python.version} >= 26} {
        destroot.args       PYTHON_SITE_PACKAGES="${frameworks_dir}/Python.framework/Versions/${python.branch}/lib/python${python.branch}/site-packages"
    }

    post-destroot {
        move ${destroot}${prefix}/share/doc/libxslt-python-${version} \
             ${destroot}${prefix}/share/doc/${subport}
    }
    livecheck.type  none
} else {
    distfiles
    supported_archs noarch
    replaced_by py24-libxslt
    depends_lib port:py24-libxslt
    patch {}
    build {}
    destroot {
        system "echo $name is a stub port > ${destroot}${prefix}/share/doc/${name}/README"
    }

    livecheck.type  regex
    livecheck.url   ${homepage}news.html
    livecheck.regex {<h3>(\d+(?:\.\d+)*): .*</h3>}
}
