# -*- 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 92322 2012-04-25 02:56:54Z ryandesign@macports.org $

PortSystem 1.0
PortGroup	python 1.0

name			py-wxpython
version			2.8.12.1
revision		1
categories		python graphics
platforms		darwin
python.versions	24 25 27
maintainers		jwa
description		Python interface to the wxWindows cross platform GUI
long_description	wxPython is a GUI toolkit for the Python programming \
    language. It allows Python programmers to create \
    programs with a robust, highly functional graphical \
    user interface, simply and easily. It is implemented \
    as a Python extension module (native code) that wraps \
    the popular wxWindows cross platform GUI library, \
    which is written in C++.

homepage		http://www.wxpython.org/
master_sites	sourceforge:wxpython
distname		wxPython-src-${version}
use_bzip2		yes

checksums           rmd160  94eae06087bdd930e21bf90cc6672f93a1f5a17a \
                    sha256  1f3f153d9f1504c6ce2d2c4b23e940b8f58b81f4cba35cda1a5bb31142243cd0

if {$subport != $name} {

depends_lib-append	port:wxWidgets

# wxWidgets is not 64-bit
supported_archs	i386 ppc

worksrcdir		${distname}/wxPython

extract.post_args	"| tar -xf - ${worksrcdir} ${distname}/docs"

patchfiles		patch-config.py.diff

universal_variant	no

build.env		UNICODE="1" WXPORT="mac" PATH="${prefix}/lib/wx-devel/bin:$env(PATH)"

destroot.env	UNICODE="1" WXPORT="mac" PATH="${prefix}/lib/wx-devel/bin:$env(PATH)"

post-patch {
    if {[vercmp $xcodeversion 4.3] >= 0} {
        reinplace "s;@developer_dir@;${developer_dir}/Platforms/MacOSX.platform/Developer;" ${worksrcpath}/config.py
    } else {
        reinplace "s;@developer_dir@;${developer_dir};" ${worksrcpath}/config.py
    }
}


if {${os.platform} == "darwin" && ${os.major} >= 10} {
    build.env-append	CC=${configure.cc} \
        CXX=${configure.cxx} \
        CPP=${configure.cpp}
    destroot.env-append	CC=${configure.cc} \
        CXX=${configure.cxx} \
        CPP=${configure.cpp}
}

    post-destroot {
        xinstall -d -m 755 ${destroot}${prefix}/share/doc/
        file copy ${worksrcpath}/docs ${destroot}${prefix}/share/doc/${subport}
        file copy ${worksrcpath}/samples \
            ${destroot}${prefix}/share/doc/${subport}/examples
    }
}

if {$subport == $name} {
    livecheck.type	regex
    livecheck.url	${homepage}
    livecheck.regex	wxPython(?: | \\(classic\\) )(2\\.\[0-9\]+\\.\[0-9\]+\\.\[0-9\]+)
} else {
    livecheck.type	none
}
