# $Id: Portfile 114324 2013-12-05 08:44:51Z ryandesign@macports.org $

PortSystem 1.0
PortGroup python 1.0

name			py-utidylib
version			0.2
revision		2
platforms		darwin
supported_archs	noarch
license			MIT
maintainers		amln.net:dima openmaintainer
description		Python interface to html tidy
long_description	Python interface to html tidy, the html and xml \
			cleanup tool from the w3c.

homepage		http://utidylib.berlios.de/

python.versions	25 26 27

if {${name} ne ${subport}} {
    master_sites		http://download.berlios.de/utidylib/
    distname		uTidylib-${version}
    checksums		md5 c9f16988f92ef660f46523192ef37462
    use_zip			yes

    patchfiles		patch-lib.py.diff patch-lib.py-64bit.diff

    depends_lib-append	port:tidy \
			port:py${python.version}-epydoc

    post-patch	{
        reinplace "s|__TIDYLIB__|${prefix}/lib/libtidy.dylib|g" \
            ${worksrcpath}/tidy/lib.py
    }

    post-build	{
        system -W ${worksrcpath} "${python.bin} gendoc.py"
        file rename ${worksrcpath}/apidoc ${worksrcpath}/doc
    }

    post-destroot	{
        file delete -force ${destroot}${prefix}/share/doc/${subport}
        file copy ${worksrcpath}/doc ${destroot}${prefix}/share/doc/${subport}
        xinstall -m 644 -W ${worksrcpath} INSTALL.txt README.path README.txt \
            ${destroot}${prefix}/share/doc/${subport}
    }
}
