# -*- 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 119081 2014-04-16 19:39:30Z macsforever2000@macports.org $

PortSystem        1.0
PortGroup         python 1.0

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

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

homepage          https://pypi.python.org/pypi/python-dateutil
master_sites      https://pypi.python.org/packages/source/p/python-dateutil
distname          ${my_name}-${version}

checksums         rmd160 e72e546d762ffb3c2c952fcc77031352a9992b27 \
                  sha256 eec865307ebe7f329a6a9945c15453265a449cdaaf3710340828a1934d53e468

python.versions   26 27 31 32 33 34

if {${name} ne ${subport}} {
    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}

        # Fix permissions problems on these files
        xinstall -m 0644 -W ${worksrcpath}/python_dateutil.egg-info \
            PKG-INFO SOURCES.txt dependency_links.txt not-zip-safe requires.txt top_level.txt \
            ${destroot}${python.pkgd}/python_dateutil-${version}-py${python.branch}.egg-info

    }
    livecheck.type    none
} else {
    livecheck.type    regex
    livecheck.regex   /${my_name}-(\\d+(?:\\.\\d+)*)
}

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
            }
        }
    }
}
