# -*- 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

PortSystem          1.0
PortGroup           python      1.0
PortGroup           wxWidgets   1.0

name                py-wxpython-4.0
version             4.1.1
revision            2
distname            wxPython-${version}
set wx_version      [join [lrange [split ${version} .] 0 2] .]
set branch          [join [lrange [split ${version} .] 0 1] .]
categories-append   graphics devel
license             wxwidgets-3.1
platforms           darwin
maintainers         nomaintainer

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++.

homepage            http://www.wxpython.org/
master_sites        pypi:w/wxPython

checksums           rmd160  e0d66dfb24bd7738306e70588ed0a5f6f7116de1 \
                    sha256  00e5e3180ac7f2852f342ad341d57c44e7e4326de0b550b9a5c4a8361b6c3528 \
                    size    66043287

patchfiles-append   fix_cc_cxx.patch
patch.pre_args      -p1

python.versions     27 35 36 37 38 39

if {${name} ne ${subport}} {
    if {${python.version} == 27} {
      conflicts       py${python.version}-wxpython-3.0
    }

    # wxPython uses internal wxwidgets source code
    # therefore should be not needed
    # note: doesn't work with system wx
    wxWidgets.use   wxWidgets-3.2

    depends_lib-append \
        port:${wxWidgets.port} \
        port:py${python.version}-pathlib2 \
        port:py${python.version}-pip \
        port:py${python.version}-sip

    depends_run-append \
        port:py${python.version}-numpy \
        port:py${python.version}-pillow \
        port:py${python.version}-six

    build.env-append SIP=${python.prefix}/bin/sip
    build.env-append PATH=${wxWidgets.prefix}/bin:$env(PATH)
    build.cmd       ${python.bin} build.py build --release
    destroot.cmd    ${python.bin} setup.py

    post-destroot {
        delete      ${destroot}${wxWidgets.prefix}
    }

    livecheck.type  none
} else {
    livecheck.url   https://api.github.com/repos/wxWidgets/wxPython/tags
    livecheck.regex tarball/wxPy-(3\\.0\\.\[^"\]+)
}
