# -*- coding: utf-8; mode: tcl; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- vim:fenc=utf-8:ft=tcl:et:sw=4:ts=4:sts=4
# $Id: Portfile 92506 2012-04-30 13:42:19Z eborisch@macports.org $

PortSystem          1.0
name                py-htmldocs
PortGroup           python 1.0
python.versions     25 26 27 31 32
python.default_version 27
version             1.0
revision            1
license             {PSF}

if {$subport != $name} {
    if {${python.version} == 25} {
        version             2.5.4
    }
    if {${python.version} == 26} {
        version             2.6.8
    }
    if {${python.version} == 27} {
        version             2.7.3
    }
    if {${python.version} == 31} {
        version             3.1.5
    }
    if {${python.version} == 32} {
        version             3.2.3
    }
}

categories          lang
platforms           darwin
maintainers         eborisch \
                    openmaintainer
supported_archs     noarch

use_bzip2           yes
use_configure       no

description         HTML documentation for Python
long_description    ${description}. Unified port supplies py2\[567\]-htmldocs
homepage            http://www.python.org/

if {${name} != ${subport}} {
    description         HTML documentation for Python ${version}
    long_description    ${description}. Accessible at \
                        file://${prefix}/share/doc/python${python.version}-doc/index.html

    master_sites        http://www.python.org/ftp/python/doc/${version}/
    distname            python-${version}-docs-html
    set extractname     ${distname}

    if {${python.version} == 25} {
        distname            html-${version}
        set extractname     Python-Docs-2.5.4
        checksums           rmd160  78cf1d55bc50b9c4535d1519a11a0a4e1a47a12e \
                            sha256  b73eaeaf0400e64d9bb223cfb0d09a935e8044f0ba485e5bc549b003e6df8325
    }

    if {${python.version} == 26} {
        checksums           rmd160  9e8291a9d4fe6253ee91818fe085433c363e40d1 \
                            sha256  d1ceaf95e63c6728823da23ae15011f98f35b6ac27cf9738ceb6429566b47f26
    }

    if {${python.version} == 27} {
        checksums           rmd160  3b10444a0c1dfd412cb1a5b22e568f5ed074a078 \
                            sha256  b294008007956d600ec78335d7afedda19bf855b008a3586343cd15f8115e9c1
    }
    
    if {${python.version} == 31} {
        checksums           rmd160  29717979d6a8b4e970a4747e101259da3e3890c1 \
                            sha256  ff327cfaa1219d8d82fcb4f3bae3ec4ce28567982a49784004130521d282faa0
    }
    
    if {${python.version} == 32} {
        checksums           rmd160  97f6f586eca112723479837ea902d17d0814a17d \
                            sha256  1dd4a63dad800fe4207498b7d1ab1f3a8d7c77073fc8c9f5a519d8079ecf1715
    }

    build {}

    destroot {
        set  destdocdir ${destroot}${prefix}/share/doc/python${python.version}-doc
        file mkdir ${destroot}${prefix}/share/doc
        file copy ${workpath}/${extractname} ${destdocdir}
        system "chmod -R a+rX ${destdocdir}" 
    }
    
    livecheck.url       http://www.python.org/ftp/python/doc/
    livecheck.type      regex
    set version_pattern [string range ${python.version} 0 end-1]\\.[string index ${python.version} end]
    livecheck.regex     (${version_pattern}\[\\.0-9\]*)
} else {
    livecheck.type      none
}


