# -*- 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 106361 2013-05-23 15:31:25Z eborisch@macports.org $

PortSystem          1.0
name                py-htmldocs
PortGroup           python 1.0
python.versions     25 26 27 31 32 33
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.5 }
    if {${python.version} == 31} { version 3.1.5 }
    if {${python.version} == 32} { version 3.2.5 }
    if {${python.version} == 33} { version 3.3.2 }
}

categories          lang
platforms           darwin
maintainers         eborisch \
                    openmaintainer
supported_archs     noarch

use_bzip2           yes
use_configure       no

description         Local HTML documentation for Python.
long_description    ${description}
homepage            http://www.python.org/
master_sites        http://www.python.org/ftp/python/doc/

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}
    depends_lib-delete  port:python${python.version}
    
    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  500aae50e5247191c0669bbe0bed426a7dd2c703 \
                            sha256  bb1b8ada858bae3b9e94a7fefe77536f68ce924f2c19b57e5f47c111c29415a3
    }
    
    if {${python.version} == 31} {
        checksums           rmd160  29717979d6a8b4e970a4747e101259da3e3890c1 \
                            sha256  ff327cfaa1219d8d82fcb4f3bae3ec4ce28567982a49784004130521d282faa0
    }
    
    if {${python.version} == 32} {
        checksums           rmd160  1623e93d6694ec9fa421d2f7345758c85419fc46 \
                            sha256  5a7f7f79d58cf87511aae66784ae71e3e108ca8185bd40706c4bb43e5e0348bc
    }

    if {${python.version} == 33} {
        checksums           rmd160  b4f10bbd88f3efd28f01f2d7fd517ab4b8ae23c6 \
                            sha256  7434bbb654c45ccc29825f15df2137944c53c5b737a94eadbcbb006dd2848cd4
    }

    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
}


