# -*- Mode: Tcl; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- vim:et:sw=4:ts=4:sts=4
# $Id: Portfile 107266 2013-06-24 20:53:41Z ryandesign@macports.org $

PortSystem 1.0
PortGroup python 1.0

# Please keep the version of the libxml2 and py-libxml2 ports the same.

name                    py-libxml2
version                 2.9.1
categories-append       textproc
license                 MIT
platforms               darwin
maintainers             sfiera mcalhoun openmaintainer
description             Python bindings for libxml2
long_description        ${description}

homepage                http://xmlsoft.org/python.html

master_sites            ftp://fr.rpmfind.net/pub/libxml/ \
                        ftp://gd.tuwien.ac.at/pub/libxml/ \
                        ${homepage}sources/ \
                        ftp://xmlsoft.org/libxml2/

distname                libxml2-${version}
dist_subdir             libxml2

checksums               rmd160  257285d9ac070ed9f58666b7bd7c4653651c871b \
                        sha256  fd3c64cb66f2c4ea27e934d275904d92cec494a8e8405613780cbc8a71680fdb

python.versions         24 25 26 27

if {$subport != $name} {
    depends_lib-append      port:libxml2
    
    worksrcdir              ${worksrcdir}/python
    
    patchfiles              patch-setup.py.diff
    post-patch {
      reinplace "s|@PREFIX@|$prefix|" ${worksrcpath}/setup.py
    }
    
    post-destroot {
      set docdir ${prefix}/share/doc/${subport}
      xinstall -d ${destroot}${docdir}
      xinstall -m 644 -W ${worksrcpath} README TODO \
        ${destroot}${docdir}
    }
    livecheck.type  none
} else {
    livecheck.type  regex
    livecheck.url   ${homepage}news.html
    livecheck.regex {<h3>(\d+(?:\.\d+)*): .*</h3>}
}
