# $Id: Portfile 68044 2010-05-25 09:17:59Z arthurk@macports.org $

PortSystem          1.0
PortGroup           python24 1.0

name                py-django
version             1.2.1
categories-append   www
platforms           darwin
maintainers         arthurk
homepage            http://www.djangoproject.com
description         Django is a high-level Python Web framework
long_description    Django is a high-level Python Web framework that \
                    encourages rapid development and clean, pragmatic \
                    design.

master_sites        http://media.djangoproject.com/releases/1.2/
distname            Django-${version}
checksums           md5     2351efb20f6b7b5d9ce80fa4cb1bd9ca \
                    sha1    1b5655f300d7333be06289451723dc5260a9944c \
                    rmd160  25904c6f450e88404256f951ee39cb6b39de5f76

depends_lib-append  port:py-setuptools

variant bash_completion {
    depends_run-append  port:bash-completion

    post-patch {
        reinplace "s|django-admin.py|django-admin-2.4.py|g" \
            ${worksrcpath}/extras/django_bash_completion
    }

    post-destroot {
        xinstall -d ${destroot}${prefix}/etc/bash_completion.d
        xinstall -m 644 ${worksrcpath}/extras/django_bash_completion \
            ${destroot}${prefix}/etc/bash_completion.d/django-admin-2.4.py
    }
}

post-destroot   {
    xinstall -m 644 -W ${worksrcpath} AUTHORS INSTALL LICENSE README \
        ${destroot}${prefix}/share/doc/${name}

    file copy ${worksrcpath}/docs ${destroot}${prefix}/share/doc/${name}/docs
    
    # To avoid conflict between py*-django
    move ${destroot}${prefix}/bin/django-admin.py \
        ${destroot}${prefix}/bin/django-admin-2.4.py
}

livecheck.type      regex
livecheck.url       http://www.djangoproject.com/download/
livecheck.regex     "The latest official version is (1\.\[0-9\]+\.\[0-9\]+)"
