# -*- 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 106911 2013-06-11 14:40:14Z jmr@macports.org $

PortSystem 1.0
PortGroup python 1.0

name            py-pyobjc
version         2.5.1
categories-append     devel
license         MIT
maintainers     nomaintainer
platforms       darwin
description     bidirectional bridge between python and Objective C
long_description    The PyObjC project aims to provide a bridge between \
                the Python and Objective-C programming languages. The \
                bridge is intended to be fully bidirectional, allowing \
                the Python programmer to take full advantage of the \
                power provided by various Objective-C based toolkits \
                and the Objective-C programmer transparent access to \
                Python based functionality.

homepage        http://pyobjc.sourceforge.net/
master_sites    http://pypi.python.org/packages/source/p/pyobjc-core/
distname        pyobjc-core-${version}
checksums       rmd160  26e9764fda522993670898369115f0af9c480bce \
                sha256  164617f61ede177ff60cb4a6103326645c9d87aadee04b15493c3b49e31049e6

python.versions 24 25 26 27 31 32 33

if {$subport != $name} {
    depends_lib     port:py${python.version}-setuptools \
                    port:py${python.version}-py2app

    set readme_name README.txt
    if {${python.version} <= 25} {
        if {${python.version} == 24} {
            version         2.0
            depends_lib-append  port:py24-elementtree
            fetch.type      svn
            svn.url         http://svn.red-bean.com/pyobjc/tags/r200-leopard/pyobjc-core/
            worksrcdir      pyobjc-core

            patchfiles      patch-PyErr_WarnEx.diff undef_snprintf.diff setup.py.diff

            set readme_name ReadMe.txt
        } else {
            version         2.2
            patchfiles      objc-class.m.diff
            distname        pyobjc-core-${version}
            checksums       md5 91155ec6b319c9b4b066a616dccbdaa2 \
                            sha1 6e1fbfa5708eefaf7a36147daf21f0aab62ec1e4 \
                            rmd160 a7063fe74ecc95b3105e78196e5b5adc3bba3d4a
        }
        platform darwin 12 {
            patchfiles-append 		patch-Modules-${version}.diff
        }
    }

    platform darwin 8 {
        depends_fetch
        depends_lib
        pre-fetch {
            return -code error "PyObjC 2 requires Mac OS X 10.5 or later"
        }
    }

    post-destroot {
        xinstall -m 644 -W ${worksrcpath} HISTORIC.txt Install.txt \
            License.txt NEWS.txt $readme_name \
            ${destroot}${prefix}/share/doc/${subport}
        copy ${worksrcpath}/Doc ${destroot}${prefix}/share/doc/${subport}/html
        delete ${destroot}${prefix}/share/doc/${subport}/examples
        copy ${worksrcpath}/Examples \
            ${destroot}${prefix}/share/doc/${subport}/examples
    }

    livecheck.type  none
} else {
    livecheck.type  regex
    livecheck.url   http://pypi.python.org/pypi/pyobjc-core/
    livecheck.regex {pyobjc-core ([0-9.]+)}
}
