# -*- coding: utf-8; mode: tcl; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 4 -*- vim:fenc=utf-8:ft=tcl:et:sw=2:ts=2:sts=2
PortGroup active_variants 1.1
set branch [join [lrange [split ${version} .] 0 1] .]
categories-append graphics devel
description Python interface to the wxWidgets ${branch} 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 wxWidgets cross platform GUI library, written in C++. \
Version 2.8 is provided for compatibility reasons only. \
See description of wxWidgets-2.8 for further details.
homepage http://www.wxpython.org/
master_sites sourceforge:wxpython
checksums rmd160 94eae06087bdd930e21bf90cc6672f93a1f5a17a \
sha256 1f3f153d9f1504c6ce2d2c4b23e940b8f58b81f4cba35cda1a5bb31142243cd0
python.default_version 27
distfiles ${distname}-src-${version}${extract.suffix}
dist_subdir ${distname}/${version}
worksrcdir ${distname}-src-${version}/wxPython
# extract just the docs and wxPython subdir
extract.post_args "| tar -xf - ${worksrcdir} ${distname}-src-${version}/docs"
if {${name} ne ${subport}} {
conflicts py${python.version}-wxpython-3.0
depends_lib-append port:py${python.version}-numeric
patchfiles patch-config.py.diff
variant carbon conflicts gtk description {use 32-bit carbon-based wxWidgets} {
wxWidgets.use wxWidgets-2.8
depends_run-append port:${wxWidgets.port}
# TODO: the following line would end up with --no-user-cfg
#build.args WX_CONFIG="${wxWidgets.wxconfig}"
build.cmd ${python.bin} setup.py WXPORT="mac" WX_CONFIG="${wxWidgets.wxconfig}"
destroot.cmd ${python.bin} setup.py WXPORT="mac" WX_CONFIG="${wxWidgets.wxconfig}"
# TODO: test if this works on 10.7
reinplace "s|# @@FLAGS1@@|cflags.extend(\[\"-arch\", \"[join [get_canonical_archs] {\", \"-arch\", \"}]\"\])|" ${worksrcpath}/config.py
reinplace "s|# @@FLAGS2@@|lflags.extend(\[\"-arch\", \"[join [get_canonical_archs] {\", \"-arch\", \"}]\"\])|" ${worksrcpath}/config.py
if {${wxWidgets.sdk} ne ""} {
reinplace "s|# @@FLAGS3@@|cflags.extend(\[\"-isysroot\", \"${wxWidgets.sdk}\"\])|" ${worksrcpath}/config.py
delete ${destroot}${wxWidgets.prefix}
variant gtk conflicts carbon description {use wxGTK} {
# not sure if/what other dependencies should be listed here
depends_build port:pkgconfig
depends_lib-append path:lib/pkgconfig/cairo.pc:cairo \
require_active_variants path:lib/pkgconfig/cairo.pc:cairo x11
require_active_variants gtk2 x11
build.cmd ${python.bin} setup.py WXPORT="gtk2" WX_CONFIG="${wxWidgets.wxconfig}"
destroot.cmd ${python.bin} setup.py WXPORT="gtk2" WX_CONFIG="${wxWidgets.wxconfig}"
reinplace "s|# @@FLAGS1@@|cflags.extend(\[\"-arch\", \"[join [get_canonical_archs] {\", \"-arch\", \"}]\"\])|" ${worksrcpath}/config.py
reinplace "s|# @@FLAGS2@@|lflags.extend(\[\"-arch\", \"[join [get_canonical_archs] {\", \"-arch\", \"}]\"\])|" ${worksrcpath}/config.py
delete ${destroot}${wxWidgets.prefix}