# -*- coding: utf-8; mode: tcl; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- vim:fenc=utf-8:et:sw=4:ts=4:sts=4
# $Id: Portfile 102584 2013-02-05 04:25:13Z larryv@macports.org $

PortSystem 1.0
PortGroup  python 1.0

name			py-twisted
version			12.0.0
categories-append	devel net
license			MIT
platforms		darwin
maintainers		akitada mcalhoun free.fr:olv.bonnet openmaintainer
description		An event-based Python framework for internet applications
long_description	Twisted is an event-driven networking framework \
				written in Python. Twisted supports TCP, UDP, SSL/TLS, \
				multicast, Unix sockets, a large number of protocols \
				(including HTTP, NNTP, SSH, IRC, FTP, and others), and \
				much more.

homepage		http://www.twistedmatrix.com/

set dl_version [join [lrange [split ${version} .] 0 1] .]
master_sites    http://tmrc.mit.edu/mirror/twisted/Twisted/${dl_version} \
                http://twistedmatrix.com/Releases/Twisted/${dl_version}
distname		Twisted-${version}
use_bzip2		yes

checksums       rmd160 95228c1c8919a61f84ad1d5087c8b96719f11f25 \
                sha256 e5561c9714583fd052ea9e0b10331609a719b3878f9d2593e4c57eab0ba0effd

python.versions 24 25 26 27

if {$subport != $name} {
    depends_lib-append  port:py${python.version}-zopeinterface
    post-destroot {
        # update the plugin cache
        system "PYTHONPATH=${destroot}${python.pkgd} ${python.bin} ${filespath}/getPlugins.py"
    }
    pre-activate {
        set cachefile ${python.pkgd}/twisted/plugins/dropin.cache
        if {[file exists $cachefile] && [registry_file_registered $cachefile] == "0"} {
            file delete -force $cachefile
        }
    }
    livecheck.type  none
} else {
    livecheck.type   regex
    livecheck.url    http://twistedmatrix.com/trac/wiki/Downloads
    livecheck.regex  "The current release is Twisted (\\d+(?:\\.\\d+)*)"
}

# versions 12.0.0+ require python 2.5
subport py24-twisted {
    version			11.1.0
    distname		Twisted-${version}
    set dl_version  [join [lrange [split ${version} .] 0 1] .]
    master_sites    http://tmrc.mit.edu/mirror/twisted/Twisted/${dl_version} \
                    http://twistedmatrix.com/Releases/Twisted/${dl_version}
    checksums       rmd160 569419f06bd72d658a870cee6ac596f00008a955 \
                    sha256 7fbb4529aaa3547708bb0a84377107db1e6ae7a6a9940bb8d8b05976c2754f15
}
