# -*- 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 107401 2013-06-27 05:41:21Z jmr@macports.org $

PortSystem        1.0
PortGroup         python 1.0

name              py-dateutil
set my_name       python-dateutil
version           2.0
revision          1
platforms         darwin
supported_archs   noarch
maintainers       dh ram openmaintainer
license           BSD

description       powerful extensions to the standard python datetime module
long_description  ${description}

homepage          http://labix.org/python-dateutil
master_sites      http://labix.org/download/python-dateutil
distname          ${my_name}-${version}

checksums         md5 22297f7e891bcd79a80d9446d8b20542 \
                  sha1 946337a273866cc4f51d32c86cdbc4209ab84a43 \
                  rmd160 a7ae3c4948c69471c95466236a388d63fcdac120

python.versions   24 25 26 27 31 32 33

if {${subport} != ${name}} {
    if {${python.version} < 30} {
        version 1.5
        checksums md5 35f3732db3f2cc4afdc68a8533b60a52 \
                  sha1 f489e1a70e415731d401422f711670288571040b \
                  rmd160 5f7c80ec9bf68f1708213596a994130964e91e52
        distname  ${my_name}-${version}
    }
    depends_build port:py${python.version}-setuptools
    depends_run   path:${python.pkgd}/pytz:py${python.version}-tz

    test.run          yes
    test.cmd          ${python.bin} test.py
    test.target
    test.env          PYTHONPATH=${worksrcpath}/build/lib

    post-destroot {
      set docdir ${prefix}/share/doc/${subport}
      xinstall -d ${destroot}${docdir}
      xinstall -m 0644 -W ${worksrcpath} LICENSE README NEWS ${destroot}${docdir}
    }
}

if {${name} == ${subport}} {
    livecheck.type    regex
    livecheck.regex   /${my_name}-(\\d+(?:\\.\\d+)*)
} elseif {${subport} == "py27-dateutil"} {
    livecheck.type    regex
    livecheck.regex   /${my_name}-(1.(\\d+)*)
} else {
    livecheck.type    none
}

subport py32-dateutil {
    pre-activate {
        set regref [registry_open $subport $version $revision $portvariants ""]
        foreach f [registry_prop_retr $regref imagefiles] {
            if {[file extension $f] == ".pyc" && [file exists $f] && [registry_file_registered $f] == "0"} {
                file delete -force $f
            }
        }
    }
}
