# $Id: Portfile 84847 2011-10-03 15:56:40Z jmr@macports.org $

PortSystem          1.0
PortGroup           python 1.0

name                py-pygments
version             1.4
revision            1
license             BSD
categories-append   devel
maintainers         erickt singingwolfboy openmaintainer
description         Python syntax highlighter
long_description \
    Pygments is a fast syntax highlighter written in Python with a \
    special focus on details. Can highlight source code in many supported \
    languages: Python, Ruby, PHP, HTML etc. Outputs arbitrarily-styled \
    HTML or LaTeX, comes with many builtin styles.

platforms           darwin
supported_archs     noarch

homepage            http://pygments.org/
master_sites        http://pypi.python.org/packages/source/P/Pygments
distname            Pygments-${version}

checksums           md5     d77ac8c93a7fb27545f2522abe9cc462 \
                    sha1    d34f96421a86004aa5d26ecf975edefd09f948b1 \
                    rmd160  52775927f5e1b61c4203ae21fa9347c376f59287

python.versions     24 25 26 27 31 32

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

    post-destroot {
        if {${python.version} >= 26} {
            ln -sf ${python.prefix}/bin/pygmentize \
                ${destroot}${prefix}/bin/pygmentize-${python.branch}
        } else {
            move ${destroot}${prefix}/bin/pygmentize \
                ${destroot}${prefix}/bin/pygmentize-${python.branch}
        }

        set docdir ${prefix}/share/doc/${subport}
        xinstall -d ${destroot}${docdir}
        xinstall -m 644 -W ${worksrcpath} AUTHORS CHANGES LICENSE TODO \
            ${destroot}${docdir}
        copy ${worksrcpath}/docs/build ${destroot}${docdir}/html

        if {${python.version} >= 26} {
            set man1 ${python.prefix}/share/man/man1
            xinstall -d ${destroot}${man1}
            xinstall -m 644 ${worksrcpath}/docs/pygmentize.1 ${destroot}${man1}
            ln -sf ${man1}/pygmentize.1 \
                ${destroot}${prefix}/share/man/man1/pygmentize-${python.branch}.1
        } else {
            xinstall -m 644 ${worksrcpath}/docs/pygmentize.1 \
                ${destroot}${prefix}/share/man/man1/pygmentize-${python.branch}.1
        }
    }
    livecheck.type  none
} else {
    livecheck.type  regex
    livecheck.url   ${master_sites}
    livecheck.regex {Pygments-(\d+(?:\.\d+)*)}
}
